취약한 랩을 위한 설정 커맨드

개념

홈 랩을 만들어 내부망 관련된 모의해킹을 하려면 실무에서 마주칠 수 있는 잘못된 설정을 홈랩에 "심어야"한다. 대부분의 모의해커들은 공격할 줄은 알지만, 공격이 가능한 잘못된 설정이 어디서 왜 발생한 것인지는 모르는 경우가 많다. 다음은 AD 공격과 관련된 잘못된 설정을 하는 명령어들이다.

주의

다음의 설정들은 자신의 홈랩이 아니라면 절대로 적용해서는 안된다. 이에 따라 발생할 수 있는 피해와 관련해 레드팀 프로젝트는 책임을 지지 않는다.

잘못된 설정

LDAP Signing on/off

# GPO 
Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
Domain Controller: LDAP Server Signing Requirements 

LDAP Channel Binding

# Registry 
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\NTDS\Parameters" -Name "LdapEnforceChannelBinding" -Value 3

LDAP Anonymous Bind Enabled


# Powershell 
$directoryServicesDN = "CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration," + (Get-ADDomain).DistinguishedName

$currentValue = (Get-ADObject -Identity $directoryServicesDN -Properties "dSHeuristics").dSHeuristics
if ($currentValue -ne "0000002") {
    Set-ADObject -Identity $directoryServicesDN -Replace @{dSHeuristics="0000002"}
    Write-Output "dSHeuristics updated successfully."
} else {
    Write-Output "dSHeuristics is already set to the desired value."
}

$domainDN = (Get-ADDomain).DistinguishedName
& dsacls "CN=Users,$domainDN" /G 'ANONYMOUS LOGON:GR'

# --------- GUI -----------
# ADSI and dSHeurstics setting 
ADSI Edit > Connection Settings + Select A Well known Naming Context "Configuration > 
CN=Services > CN=Windos NT > CN=Directory Services > Properties > dSHeuristics set to 0000002 (seven zeros)

# Anonymous Logon READ permission on Users Container  
ADUC > Advanced > Users Container > Properties > Permissions > Add > Anonymous Logon > "READ" permission

# ------- DEBUG --------
crackmapexec ldap <Dc> -u '' -p '' --users

SMB signing off

Defender off

Windows update off

Firewall off

Winrm

Password Policy

NTLMv1 - server

Two-way Trust

ShadowCoerce - FSRVP

DFSCoerce - DFSNM

ADCS Various ESC

LLMNR powershell scuffed version

DCSync - domain user

LSA configuration

Disable SMBv1 for no MS17-010 (shikata)

Shadow Credentials & GenericAll

Netlogon share

RBCD

LDAP Signing off

WebDAV

MachineAccountQuota - for shared lab environment

Adding Users

See my license

Rearm

Full clone machine Sysprep change SID

Allow Anonymous access on shares

Guest/Anonymous access on shares ver.2

Remove History

SCCM Server Installation

Remote Desktop Service for Windows Server machines

RDPWrap for Win10/Win11 client machines

XP_CMDSHELL vulnerable MSSQL server (kobitwave, hello - osint folks! - check git history)

Last updated