A next-generation security solution that integrates data from various security layers, such as endpoints, networks, cloud, email, and identity, on a single platform, detects threats through cross-layer correlation analysis, and provides unified response.
XDR (Extended Detection and Response) is a platform that extends the EDR (endpoint) concept to collect and analyze security events from the entire IT infrastructure, including networks, cloud workloads, email, and identity, in an integrated way. Unlike the traditional approach in which individual security tools generate alerts in their own silos, XDR normalizes and stores all data in a single data lake and uses cross-layer correlation to understand the full picture of an attack.
XDR emerged from the fragmentation of security tools and alert fatigue. The average enterprise runs more than 40 security tools, and SOC analysts have to handle thousands of alerts a day. Because each tool provides only partial information, tracing the full path of an attack means switching between multiple consoles and manually connecting data. The XDR concept, first proposed by Palo Alto Networks in 2018, aimed to solve this "tool sprawl" and "pivot tax."
XDR has three core values. First, unified visibility provides process execution on endpoints, traffic flows on the network, API calls in the cloud, and email attachment analysis in a single view. Second, automated correlation links events that look normal individually to reconstruct the attack chain. For example, it bundles the full path of "phishing email received → malicious attachment executed → credentials stolen → lateral movement" into one incident. Third, unified response performs endpoint isolation, network blocking, and account deactivation from a single platform.
XDR is divided into Native XDR and Open XDR. Native XDR tightly integrates a single vendor's EDR, NDR, email security, and so on; data normalization and correlation are smooth, but vendor lock-in is high. Open XDR connects security tools from multiple vendors via APIs, preserving existing investments while delivering XDR capabilities, but the depth of integration may be shallow. The choice depends on the organization's existing security stack and strategy.
💻 Code Example
# XDR 크로스-레이어 상관 분석 엔진 - Python
# 엔드포인트, 네트워크, 이메일, 클라우드 이벤트를 통합 분석
from datetime import datetime, timedelta
from typing import Dict, List, Optional, Set
from collections import defaultdict
from dataclasses import dataclass, field
import json
import hashlib
@dataclass
class SecurityEvent:
"""정규화된 보안 이벤트"""
timestamp: datetime
source_type: str # endpoint, network, email, cloud, identity
event_type: str # process_create, network_connection, email_received, etc.
severity: str # info, low, medium, high, critical
host: Optional[str] = None
user: Optional[str] = None
source_ip: Optional[str] = None
dest_ip: Optional[str] = None
process_name: Optional[str] = None
file_hash: Optional[str] = None
url: Optional[str] = None
email_subject: Optional[str] = None
raw_data: Dict = field(default_factory=dict)
@dataclass
class CorrelatedIncident:
"""상관 분석된 인시던트"""
incident_id: str
title: str
severity: str
events: List[SecurityEvent]
attack_chain: List[str]
mitre_techniques: List[str]
affected_assets: Set[str]
recommendations: List[str]
created_at: datetime
class XDRCorrelationEngine:
"""XDR 상관 분석 엔진 - 크로스 레이어 위협 탐지"""
def __init__(self):
self.events: List[SecurityEvent] = []
self.incidents: List[CorrelatedIncident] = []
self.correlation_rules = self._load_correlation_rules()
def _load_correlation_rules(self) -> List[Dict]:
"""상관 분석 규칙 로드"""
return [
{
"name": "Phishing Attack Chain",
"description": "피싱 이메일 → 악성 첨부파일 실행 → 후속 활동",
"pattern": [
{"source_type": "email", "event_type": "suspicious_attachment"},
{"source_type": "endpoint", "event_type": "process_create",
"conditions": {"parent_name": ["outlook.exe", "thunderbird.exe"]}},
{"source_type": "endpoint", "event_type": "process_create",
"conditions": {"name": ["powershell.exe", "cmd.exe", "wscript.exe"]}}
],
"time_window_minutes": 30,
"severity": "high",
"mitre": ["T1566.001", "T1204.002", "T1059"]
},
{
"name": "Credential Theft and Lateral Movement",
"description": "자격증명 탈취 후 측면 이동",
"pattern": [
{"source_type": "endpoint", "event_type": "lsass_access"},
{"source_type": "identity", "event_type": "auth_failure",
"conditions": {"count_threshold": 5}},
{"source_type": "network", "event_type": "smb_connection",
"conditions": {"internal_only": True}}
],
"time_window_minutes": 60,
"severity": "critical",
"mitre": ["T1003.001", "T1110", "T1021.002"]
},
{
"name": "Cloud Data Exfiltration",
"description": "클라우드 저장소로 대량 데이터 유출",
"pattern": [
{"source_type": "endpoint", "event_type": "file_access",
"conditions": {"count_threshold": 100}},
{"source_type": "network", "event_type": "dns_query",
"conditions": {"domains": ["dropbox.com", "drive.google.com",
"onedrive.live.com"]}},
{"source_type": "network", "event_type": "https_upload",
"conditions": {"size_threshold_mb": 50}}
],
"time_window_minutes": 120,
"severity": "critical",
"mitre": ["T1567.002", "T1041"]
},
{
"name": "C2 Communication Detection",
"description": "C2 서버와의 비콘 통신 탐지",
"pattern": [
{"source_type": "endpoint", "event_type": "process_create",
"conditions": {"suspicious_parent": True}},
{"source_type": "network", "event_type": "periodic_connection",
"conditions": {"interval_variance": "low", "dest_unknown": True}},
{"source_type": "network", "event_type": "dns_query",
"conditions": {"entropy": "high"}}
],
"time_window_minutes": 1440, # 24시간
"severity": "high",
"mitre": ["T1071", "T1568", "T1573"]
}
]
def ingest_event(self, event: SecurityEvent):
"""이벤트 수집 및 실시간 상관 분석 트리거"""
self.events.append(event)
# 실시간 상관 분석 실행
self._run_correlation(event)
def _run_correlation(self, trigger_event: SecurityEvent):
"""상관 분석 규칙 실행"""
for rule in self.correlation_rules:
matched_events = self._match_pattern(rule, trigger_event)
if matched_events:
incident = self._create_incident(rule, matched_events)
self.incidents.append(incident)
print(f"[INCIDENT] {incident.title}")
print(f" Severity: {incident.severity}")
print(f" Events: {len(incident.events)}")
print(f" Attack Chain: {' → '.join(incident.attack_chain)}")
def _match_pattern(self, rule: Dict, trigger_event: SecurityEvent) -> List[SecurityEvent]:
"""패턴 매칭 - 시간 윈도우 내 관련 이벤트 검색"""
time_window = timedelta(minutes=rule["time_window_minutes"])
pattern = rule["pattern"]
# 트리거 이벤트가 패턴의 마지막 단계와 일치하는지 확인
last_step = pattern[-1]
if not self._event_matches_step(trigger_event, last_step):
return []
# 시간 윈도우 내 이전 단계들 검색
matched_chain = [trigger_event]
for step in reversed(pattern[:-1]):
window_start = trigger_event.timestamp - time_window
# 같은 호스트/사용자의 이벤트 검색
candidates = [
e for e in self.events
if window_start <= e.timestamp <= trigger_event.timestamp
and self._event_matches_step(e, step)
and self._events_related(e, trigger_event)
]
if candidates:
matched_chain.insert(0, candidates[-1]) # 가장 최근 이벤트
else:
return [] # 패턴 불일치
return matched_chain if len(matched_chain) == len(pattern) else []
def _event_matches_step(self, event: SecurityEvent, step: Dict) -> bool:
"""개별 이벤트가 패턴 단계와 일치하는지 확인"""
if event.source_type != step["source_type"]:
return False
if event.event_type != step["event_type"]:
return False
# 추가 조건 확인
conditions = step.get("conditions", {})
for key, value in conditions.items():
if key == "parent_name":
if event.raw_data.get("parent_name", "").lower() not in [v.lower() for v in value]:
return False
elif key == "name":
if event.process_name and event.process_name.lower() not in [v.lower() for v in value]:
return False
# ... 추가 조건 처리
return True
def _events_related(self, event1: SecurityEvent, event2: SecurityEvent) -> bool:
"""두 이벤트가 같은 엔티티(호스트/사용자)와 관련되어 있는지 확인"""
# 같은 호스트
if event1.host and event2.host and event1.host == event2.host:
return True
# 같은 사용자
if event1.user and event2.user and event1.user == event2.user:
return True
# IP 관련성
if event1.source_ip and event2.source_ip and event1.source_ip == event2.source_ip:
return True
return False
def _create_incident(self, rule: Dict, events: List[SecurityEvent]) -> CorrelatedIncident:
"""인시던트 생성"""
affected_assets = set()
attack_chain = []
for event in events:
if event.host:
affected_assets.add(f"host:{event.host}")
if event.user:
affected_assets.add(f"user:{event.user}")
attack_chain.append(f"{event.source_type}:{event.event_type}")
incident_id = hashlib.md5(
f"{rule['name']}-{events[0].timestamp}".encode()
).hexdigest()[:12]
return CorrelatedIncident(
incident_id=f"XDR-{incident_id}",
title=rule["name"],
severity=rule["severity"],
events=events,
attack_chain=attack_chain,
mitre_techniques=rule.get("mitre", []),
affected_assets=affected_assets,
recommendations=self._generate_recommendations(rule),
created_at=datetime.utcnow()
)
def _generate_recommendations(self, rule: Dict) -> List[str]:
"""인시던트 유형별 대응 권장사항 생성"""
recommendations = []
if "Phishing" in rule["name"]:
recommendations.extend([
"의심스러운 이메일 발신자 차단",
"영향받은 엔드포인트 격리",
"사용자 비밀번호 재설정",
"조직 내 유사 이메일 검색 및 삭제"
])
elif "Credential" in rule["name"]:
recommendations.extend([
"영향받은 계정 즉시 비활성화",
"모든 세션 강제 종료",
"측면 이동 대상 시스템 점검",
"특권 계정 감사"
])
elif "Exfiltration" in rule["name"]:
recommendations.extend([
"네트워크 연결 즉시 차단",
"유출 데이터 범위 파악",
"법무팀/경영진 에스컬레이션",
"포렌식 데이터 보존"
])
return recommendations
def query_events(self, query: Dict, time_range_hours: int = 24) -> List[SecurityEvent]:
"""이벤트 검색 쿼리"""
cutoff = datetime.utcnow() - timedelta(hours=time_range_hours)
results = []
for event in self.events:
if event.timestamp < cutoff:
continue
match = True
for key, value in query.items():
if hasattr(event, key):
if getattr(event, key) != value:
match = False
break
elif key in event.raw_data:
if event.raw_data[key] != value:
match = False
break
if match:
results.append(event)
return results
# 사용 예시
if __name__ == "__main__":
xdr = XDRCorrelationEngine()
# 시뮬레이션: 피싱 공격 체인
base_time = datetime.utcnow()
# 1. 의심스러운 이메일 수신
xdr.ingest_event(SecurityEvent(
timestamp=base_time,
source_type="email",
event_type="suspicious_attachment",
severity="medium",
user="john.doe@company.com",
email_subject="Invoice_2024.xlsm",
raw_data={"attachment_type": "xlsm", "sender": "attacker@malicious.com"}
))
# 2. Outlook에서 프로세스 생성
xdr.ingest_event(SecurityEvent(
timestamp=base_time + timedelta(minutes=5),
source_type="endpoint",
event_type="process_create",
severity="medium",
host="WORKSTATION-001",
user="john.doe@company.com",
process_name="excel.exe",
raw_data={"parent_name": "outlook.exe", "cmdline": "excel.exe Invoice_2024.xlsm"}
))
# 3. PowerShell 실행 (매크로)
xdr.ingest_event(SecurityEvent(
timestamp=base_time + timedelta(minutes=6),
source_type="endpoint",
event_type="process_create",
severity="high",
host="WORKSTATION-001",
user="john.doe@company.com",
process_name="powershell.exe",
raw_data={"parent_name": "excel.exe", "cmdline": "powershell -enc ..."}
))
print(f"\n총 인시던트: {len(xdr.incidents)}")
// XDR 위협 헌팅 쿼리 - KQL (Kusto Query Language)
// Microsoft Defender XDR, Azure Sentinel 등에서 사용
// ==============================================
// 1. 크로스-레이어 피싱 공격 체인 탐지
// ==============================================
// 이메일 → 엔드포인트 → 네트워크 상관 분석
let timeWindow = 1h;
let suspiciousEmails = EmailEvents
| where Timestamp > ago(timeWindow)
| where AttachmentCount > 0
| where ThreatTypes has_any ("Phish", "Malware")
| project EmailTimestamp=Timestamp, RecipientEmailAddress,
SenderFromAddress, Subject, AttachmentCount;
let endpointActivity = DeviceProcessEvents
| where Timestamp > ago(timeWindow)
| where InitiatingProcessFileName in~
("outlook.exe", "thunderbird.exe", "excel.exe", "word.exe")
| where FileName in~
("powershell.exe", "cmd.exe", "wscript.exe", "mshta.exe")
| project ProcessTimestamp=Timestamp, DeviceName, AccountName,
FileName, ProcessCommandLine, InitiatingProcessFileName;
suspiciousEmails
| join kind=inner (endpointActivity)
on $left.RecipientEmailAddress == $right.AccountName
| where ProcessTimestamp between (EmailTimestamp .. (EmailTimestamp + timeWindow))
| project EmailTimestamp, ProcessTimestamp, RecipientEmailAddress,
Subject, DeviceName, FileName, ProcessCommandLine
| extend AttackChain = "Email → Endpoint Execution"
// ==============================================
// 2. 자격증명 탈취 후 측면 이동 탐지
// ==============================================
let credentialTheft = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "lsass.exe" or
ProcessCommandLine has_any ("mimikatz", "sekurlsa", "procdump")
| project CredTheftTime=Timestamp, DeviceName, AccountName;
let lateralMovement = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemotePort in (445, 135, 3389, 5985) // SMB, RPC, RDP, WinRM
| where RemoteIPType == "Private"
| summarize ConnectionCount=count(),
TargetHosts=make_set(RemoteIP)
by DeviceName, AccountName, bin(Timestamp, 1h);
credentialTheft
| join kind=inner (lateralMovement)
on DeviceName, AccountName
| where Timestamp > CredTheftTime
| project CredTheftTime, Timestamp, DeviceName, AccountName,
ConnectionCount, TargetHosts
| extend AttackStage = "Post-Credential Theft Lateral Movement"
| where ConnectionCount > 5
// ==============================================
// 3. C2 비콘 통신 패턴 탐지
// ==============================================
let beaconDetection = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemoteIPType == "Public"
| summarize
ConnectionCount = count(),
AvgInterval = avg(datetime_diff('second', Timestamp,
prev(Timestamp, 1) over (partition by DeviceName,
RemoteIP order by Timestamp))),
IntervalStdDev = stdev(datetime_diff('second', Timestamp,
prev(Timestamp, 1) over (partition by DeviceName,
RemoteIP order by Timestamp))),
FirstSeen = min(Timestamp),
LastSeen = max(Timestamp),
TotalBytes = sum(SentBytes + ReceivedBytes)
by DeviceName, RemoteIP, RemotePort, InitiatingProcessFileName
| where ConnectionCount > 10
| where IntervalStdDev < 60 // 규칙적인 간격 (편차 60초 미만)
| where AvgInterval between (30 .. 3600) // 30초 ~ 1시간 간격
| extend BeaconScore = 100 - (IntervalStdDev / AvgInterval * 100)
| where BeaconScore > 70
| project DeviceName, RemoteIP, RemotePort, InitiatingProcessFileName,
ConnectionCount, AvgInterval, BeaconScore, FirstSeen, LastSeen
// ==============================================
// 4. 클라우드 서비스로 데이터 유출 탐지
// ==============================================
let cloudUploadDomains = dynamic([
"dropbox.com", "drive.google.com", "onedrive.live.com",
"mega.nz", "wetransfer.com", "box.com"
]);
let largeFileAccess = DeviceFileEvents
| where Timestamp > ago(4h)
| where ActionType == "FileRead"
| where FolderPath has_any ("Documents", "Desktop", "Downloads",
"Confidential", "Finance", "HR")
| summarize FileCount=count(), TotalSize=sum(FileSize)
by DeviceName, AccountName, bin(Timestamp, 15m)
| where FileCount > 50 or TotalSize > 100000000; // 50+ files or 100MB+
let cloudUploads = DeviceNetworkEvents
| where Timestamp > ago(4h)
| where RemoteUrl has_any (cloudUploadDomains)
| where SentBytes > 1000000 // 1MB+
| summarize UploadCount=count(), TotalUploaded=sum(SentBytes)
by DeviceName, AccountName, RemoteUrl, bin(Timestamp, 15m);
largeFileAccess
| join kind=inner (cloudUploads)
on DeviceName, AccountName
| where Timestamp1 between ((Timestamp - 15m) .. (Timestamp + 15m))
| project Timestamp, DeviceName, AccountName, FileCount, TotalSize,
RemoteUrl, TotalUploaded
| extend AlertTitle = "Potential Data Exfiltration to Cloud Storage",
Severity = "Critical"
// ==============================================
// 5. 통합 인시던트 뷰 - 공격 타임라인
// ==============================================
let incidentId = "INC-2024-001";
let targetUser = "john.doe@company.com";
let timeRange = 7d;
union
(EmailEvents
| where RecipientEmailAddress =~ targetUser
| where Timestamp > ago(timeRange)
| project Timestamp, Source="Email",
Activity=strcat("Received: ", Subject),
Details=strcat("From: ", SenderFromAddress)),
(DeviceProcessEvents
| where AccountName =~ targetUser
| where Timestamp > ago(timeRange)
| project Timestamp, Source="Endpoint",
Activity=strcat("Process: ", FileName),
Details=ProcessCommandLine),
(DeviceNetworkEvents
| where InitiatingProcessAccountName =~ targetUser
| where Timestamp > ago(timeRange)
| project Timestamp, Source="Network",
Activity=strcat("Connection to ", RemoteIP),
Details=strcat("Port: ", RemotePort)),
(IdentityLogonEvents
| where AccountUpn =~ targetUser
| where Timestamp > ago(timeRange)
| project Timestamp, Source="Identity",
Activity=strcat("Logon: ", LogonType),
Details=strcat("From: ", DeviceName))
| order by Timestamp asc
| extend IncidentId = incidentId
| project-reorder Timestamp, Source, Activity, Details
"We currently run EDR, NDR, and SIEM separately, and alert fatigue is severe. Last month, tracing a single phishing attack took 6 hours of switching between three consoles. With XDR, cross-layer correlation automatically links the attack chain, and we can significantly reduce MTTD (mean time to detect) and MTTR (mean time to respond)."
💬 In an incident response briefing
"This is an incident that XDR correlated automatically. Looking at the attack chain, a marketing team employee opened a phishing email attachment, an Excel macro launched PowerShell, and then it attempted an SMB connection to the internal network. Email, endpoint, and network events were bundled into one incident, so we could grasp the full picture at a glance."
💬 In an XDR vendor selection meeting
"We have to choose between Native XDR and Open XDR. We already use CrowdStrike EDR, Palo Alto firewalls, and Microsoft 365, so Open XDR can integrate them while preserving existing investments. However, we must verify the API integration quality and correlation depth in a PoC."
⚠️ Cautions & Best Practices
❌
Being swayed by marketing terms
Many vendors just attach an "XDR" label to existing products. True XDR is defined by multi-source data integration, automated correlation, and unified response. Test real cross-layer detection scenarios in the PoC.
❌
Keeping data silos as they are
Adopting XDR has no effect if you don't integrate the data from existing tools. Connect all relevant log sources (endpoint, network, cloud, email, identity) to XDR and integrate them into a normalized schema.
❌
Neglecting correlation rules
Default rules alone make it hard to detect threats specific to your environment. Train a baseline of the organization's normal behavior, continuously develop custom detection rules, and monitor and tune the false positive rate.
✅
XDR best practices
Establish phased integration (starting with core sources), threat hunting capability development, response automation through SOAR integration, a regular detection rule development cycle, and a vendor lock-in management strategy. XDR is not a tool but an integrated security operations model.