IDS & IPS
What is an Intrusion Detection System (IDS)?
An Intrusion Detection System (IDS), as its name suggests, is a device that detects malicious activities or policy violations—in other words, intrusions—within a network or system, and then reports (Reporting) and logs (Logging) them to an administrator.
A key advantage of an IDS is that it analyzes a copy (or Mirror) of the network traffic, meaning it does not affect the actual network performance. However, because it is not in the direct flow of traffic, it cannot block intrusions on its own, even after detecting them.
An IDS detects intrusions primarily in two ways:
- Signature-based Detection (Misuse Detection): This method works by storing a database of known attack patterns (Signatures) and comparing incoming traffic against these patterns. It is effective at stopping known attacks but is vulnerable to new forms of attacks (Zero-day exploits).
- Anomaly-based Detection: This method first learns the normal state of a system and then flags any abnormal behavior that deviates from this established baseline as an intrusion. It can detect novel attacks but has a higher potential for false positives.
Host-based IDS (HIDS)
- Focuses on monitoring and analyzing the internal activities of a computer system.
- It is installed on an OS and tracks user account behavior, system file modifications, and process activities to detect internal threats.
- It excels at detecting malicious activities originating from within the system, such as Trojans, logic bombs, and backdoors.
- Disadvantages: It can only protect the specific host it is installed on, not the entire network. It can also be rendered useless if it becomes the target of an attack itself.
Network-based IDS (NIDS)
- Detects intrusions by collecting and analyzing packet information transmitted over the network.
- It is typically connected to a mirroring port on a switch to monitor all network traffic.
- Advantages: Its monitoring range can be flexibly adjusted based on its placement, and it is safe from direct attacks as it does not have its own IP address.
- Disadvantages: It cannot analyze the content of encrypted traffic, and it cannot determine whether an attack was ultimately successful.
What is an Intrusion Prevention System (IPS)?
An Intrusion Prevention System (IPS) is the next evolution of the IDS. It goes beyond simply detecting an intrusion and includes the functionality to actively block the corresponding attack.
Unlike an IDS, which inspects a ‘copy’ of network traffic, an IPS is positioned in-line with the traffic flow, similar to a firewall. Because every packet must pass through the IPS, it can immediately drop any packet that is identified as malicious.
- Disadvantages:
- Because it inspects all packets in real-time, it can add overhead to network performance.
- A false positive can cause serious problems. If the IPS mistakenly blocks legitimate user traffic, it can lead to a service outage.
Difference from a Firewall: What and How Deeply Do They Look?
Firewalls, IDS, and IPS all protect the network, but they differ in what they inspect and the depth of that inspection.
- Firewall: Primarily operates at the Network Layer (Layer 3) and Transport Layer (Layer 4) of the OSI model. It acts as a ‘gatekeeper’ that allows or blocks traffic based on predefined rules, looking at packet header information like IP addresses and port numbers.
- IDS/IPS: Inspects all the way up to the Application Layer (Layer 7). It performs a deep analysis not only of packet headers but also of the data contained within the packet (Payload) to check for hidden malware or known attack patterns.
For this reason, a common security architecture places these devices in the following order: Internet → Firewall → IPS → Internal Network. The firewall acts as the first line of defense, filtering out unnecessary traffic (e.g., access attempts to unallowed ports). The IPS then performs a more detailed inspection of the traffic that the firewall has allowed through, maximizing security efficiency.
False Positives vs. False Negatives: The Detection Dilemma
When discussing the performance of a security system, the most critical concepts are ‘True Positives,’ ‘False Positives,’ and ‘False Negatives.’
Actual Normal Traffic | Actual Attack Traffic | |
---|---|---|
Judged as Normal | True Negative (TN) Correctly identified normal as normal. | False Negative (FN) Incorrectly identified an attack as normal (a miss). |
Judged as Attack | False Positive (FP) Incorrectly identified normal as an attack (a false alarm). | True Positive (TP) Correctly identified an attack as an attack. |
- True Positive (TP) / True Negative (TN): Cases where the system made a correct judgment.
- False Positive (FP): An instance of ‘over-defense.’ The system misidentifies a legitimate activity as an attack, triggering an alert or a block. Too many FPs can lead to alert fatigue for administrators, causing them to miss real threats. (Type I Error)
- False Negative (FN): A ‘detection failure.’ The system fails to detect an actual attack, allowing it to pass through. This is the most critical type of error, as it undermines the very purpose of the security system. (Type II Error)
Performance Analysis: How Smart Is Our System?
The performance of an IDS/IPS cannot be evaluated simply by “how much it caught.” Using the TP, FP, FN, and TN values described above, we can precisely measure the system’s effectiveness with the following metrics.
Precision
- “Of all the items detected as attacks, what percentage were actual attacks?”
- A low value for this metric indicates a high number of false positives (FP). No matter how many alerts a system generates, it cannot be trusted if most of them are false alarms.
- \[\text{Precision} = \frac{TP}{TP + FP}\]
Recall (Sensitivity)
- “Of all actual attacks that occurred, what percentage did our system successfully detect?”
- In statistics, this is also known as ‘Sensitivity.’ A low value for this metric means there are many false negatives (FN), which is extremely dangerous as it signifies that real attacks are being missed.
- \[\text{Recall} = \frac{TP}{TP + FN}\]
The Relationship Between Precision and Recall
Precision and Recall typically have an inverse relationship (a trade-off). If you make the detection policy very sensitive to increase Recall (Recall ↑), you will inevitably classify more minor anomalies as attacks, which lowers Precision (Precision ↓). Conversely, if you make the policy more conservative to only detect definitive attacks to increase Precision (Precision ↑), you may miss some ambiguous attacks, which lowers Recall (Recall ↓).
Accuracy
- “For all traffic, how correctly did the system classify it as either normal or malicious?”
- While this is the most intuitive metric, it should not be relied upon exclusively, as it can be misleading when data is imbalanced (e.g., when attack traffic makes up only 0.01% of all traffic).
- \[\text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}\]
ROC Curve and AUC
- The ROC (Receiver Operating Characteristic) curve is a graph that visualizes the relationship between the Recall (True Positive Rate) on the Y-axis and the False Positive Rate (1 - Specificity) on the X-axis as the model’s threshold is varied.
- A curve that is closer to the top-left corner represents a better-performing model.
- The AUC (Area Under the Curve) represents the area under the ROC curve. A value closer to 1 signifies a superior model and is useful for quantitatively comparing the performance of different models.
Conclusion: The Importance of a Unified Security Strategy
As we have seen, firewalls, IDS, and IPS are all critical security components, each with distinct roles and strengths. No single piece of equipment can stop every threat.
- A firewall provides the first line of defense, blocking unnecessary access based on ports and IP addresses.
- An IDS acts as an intelligent ‘detective’ that monitors the network.
- An IPS serves as a ‘bodyguard’ that blocks threats in real time.
In a modern security environment, a Defense-in-Depth strategy is essential. This involves collecting the logs and events generated by these devices into a SIEM (Security Information and Event Management) system for integrated analysis and a coordinated response to threats. Ultimately, the strongest defense posture is achieved when multiple security layers work together, creating a synergy that compensates for each other’s weaknesses.
Intrusion Detection System(IDS)란?
침입 탐지 시스템(IDS)은 이름 그대로 네트워크나 시스템에 대한 악의적인 행위나 정책 위반, 즉 침입을 탐지하여 관리자에게 보고(Reporting)하고 기록(Logging)하는 장치입니다.
IDS는 기존 네트워크 트래픽의 사본(Mirror)을 받아 분석하므로, 실제 네트워크 성능에 영향을 미치지 않는다는 장점이 있습니다. 하지만 트래픽의 흐름에 직접 관여하지 않기 때문에, 침입을 탐지하더라도 스스로 차단할 수는 없습니다.
IDS는 크게 두 가지 방식으로 침입을 탐지합니다.
- 오용 탐지 (Misuse Detection): 이미 알려진 공격 패턴(Signature)을 데이터베이스에 저장해두고, 들어오는 트래픽이 이 패턴과 일치하는지를 비교하여 탐지합니다. 알려진 공격을 막는 데 효과적이지만, 새로운 형태의 공격(Zero-day)에는 취약합니다.
- 이상 탐지 (Anomaly Detection): 시스템의 정상적인 상태를 학습한 후, 이 정상 범위를 벗어나는 비정상적인 행위가 발생하면 침입으로 간주합니다. 새로운 공격을 탐지할 수 있지만, 오탐(False Positive)의 가능성이 있습니다.
Host-based IDS(HIDS)
- 컴퓨터 시스템의 내부를 감시하고 분석하는 데 중점을 둡니다.
- OS에 설치되어 사용자 계정의 행위, 시스템 파일 변경, 프로세스 활동 등을 추적하여 내부적인 위협을 탐지합니다.
- 트로이목마, 논리폭탄, 백도어 등 시스템 내부에서 발생하는 악성 행위 탐지에 강점이 있습니다.
- 단점: 네트워크 전체가 아닌 자신이 설치된 해당 호스트만 보호할 수 있으며, 스스로가 공격 대상이 되면 무력화될 수 있습니다.
Network-based IDS(NIDS)
- 네트워크를 통해 전송되는 패킷 정보를 수집 및 분석하여 침입을 탐지합니다.
- 보통 스위치의 미러링 포트에 연결되어 네트워크 트래픽 전체를 감시합니다.
- 장점: 설치 위치에 따라 감시 범위를 유연하게 조절할 수 있으며, 별도의 IP 주소를 갖지 않아 직접적인 공격으로부터 안전합니다.
- 단점: 암호화된 트래픽의 내용은 분석할 수 없으며, 공격이 성공했는지 여부까지는 알 수 없습니다.
Intrusion Prevention System(IPS)란?
침입 방지 시스템(IPS)은 IDS에서 한 단계 더 발전한 개념입니다. 침입을 탐지하는 것에서 그치지 않고, 해당 공격을 능동적으로 차단하는 기능까지 갖추고 있습니다.
IDS가 네트워크 트래픽의 ‘사본’을 검사하는 것과 달리, IPS는 방화벽처럼 실제 트래픽이 지나가는 경로에 인라인(In-line) 방식으로 위치합니다. 모든 패킷이 IPS를 통과해야 하므로, 악성으로 판단된 패킷을 즉시 차단(Drop)할 수 있습니다.
- 단점:
- 모든 패킷을 실시간으로 검사하기 때문에 네트워크 성능에 부하를 줄 수 있습니다.
- 오탐(False Positive) 발생 시 심각한 문제를 일으킵니다. 정상적인 사용자의 트래픽을 악성으로 잘못 판단하여 차단하면, 서비스 장애로 이어질 수 있습니다.
방화벽과의 차이: 무엇을, 얼마나 깊게 보는가?
방화벽, IDS, IPS는 모두 네트워크를 보호하지만, 검사하는 대상과 깊이가 다릅니다.
- 방화벽 (Firewall): 주로 OSI 7계층의 네트워크 계층(3계층)과 전송 계층(4계층)에서 작동합니다. IP 주소와 포트 번호 같은 패킷의 헤더 정보를 보고, 정해진 규칙에 따라 트래픽을 허용하거나 차단하는 ‘문지기’ 역할을 합니다.
- IDS/IPS: 애플리케이션 계층(7계층)까지 검사합니다. 패킷 헤더뿐만 아니라, 패킷 내부에 담긴 데이터(Payload)의 내용까지 심층적으로 분석하여 악성코드가 숨겨져 있는지, 알려진 공격 패턴이 있는지를 확인합니다.
이러한 이유 때문에, 보안 아키텍처를 구성할 때 보통 인터넷 → 방화벽 → IPS → 내부 네트워크 순서로 배치합니다. 방화벽이 1차로 불필요한 트래픽(예: 허용되지 않은 포트로의 접근)을 걸러내고, IPS가 그 뒤에서 방화벽을 통과한 트래픽의 내용까지 정밀하게 검사하여 보안 효율을 극대화하는 것입니다.
오탐(False Positive)과 미탐(False Negative): 탐지의 딜레마
보안 시스템의 성능을 이야기할 때 가장 중요한 개념이 바로 ‘정탐’, ‘오탐’, ‘미탐’입니다.
실제 정상 트래픽 | 실제 공격 트래픽 | |
---|---|---|
정상으로 판단 | True Negative (TN) 정상을 정상으로 올바르게 판단 | False Negative (FN) 공격을 정상으로 잘못 판단 (미탐) |
공격으로 판단 | False Positive (FP) 정상을 공격으로 잘못 판단 (오탐) | True Positive (TP) 공격을 공격으로 올바르게 판단 |
- True Positive (TP) / True Negative (TN): 시스템이 올바르게 판단한 경우입니다. (정탐)
- False Positive (FP): ‘과잉 방어’입니다. 정상적인 활동을 공격으로 오인하여 경보를 울리거나 차단합니다. 너무 잦으면 관리자의 피로도를 높이고 진짜 경보를 놓치게 만듭니다. (Type I Error)
- False Negative (FN): ‘탐지 실패’입니다. 실제 공격을 탐지하지 못하고 그대로 통과시킵니다. 보안 시스템의 존재 이유를 위협하는 가장 치명적인 오류입니다. (Type II Error)
성능 분석: 우리 시스템은 얼마나 똑똑할까?
IDS/IPS의 성능은 단순히 ‘많이 잡았다’로 평가할 수 없습니다. 위에서 설명한 TP, FP, FN, TN 값을 이용해 다음과 같은 지표로 시스템의 효율성을 정밀하게 측정합니다.
Precision (정밀도)
- “공격이라고 탐지한 것 중에서, 진짜 공격인 것은 얼마나 되는가?”
- 이 지표가 낮으면 오탐(FP)이 많다는 의미입니다. 아무리 많은 경보를 울려도 대부분이 가짜 경보라면 신뢰할 수 없는 시스템이 됩니다.
- \[\text{Precision} = \frac{TP}{TP + FP}\]
Recall (재현율)
- “실제 발생한 모든 공격 중에서, 우리 시스템이 탐지해낸 비율은 얼마인가?”
- 통계학에서는 ‘민감도(Sensitivity)’라고도 부릅니다. 이 지표가 낮으면 미탐(FN)이 많다는 의미이며, 실제 공격을 놓치고 있다는 뜻이므로 매우 위험합니다.
- \[\text{Recall} = \frac{TP}{TP + FN}\]
정밀도와 재현율의 관계
정밀도와 재현율은 보통 반비례(Trade-off) 관계에 있습니다. 재현율을 높이기 위해 탐지 정책을 매우 민감하게 설정하면(Recall ↑), 사소한 이상 행위까지 모두 공격으로 판단하여 정밀도가 떨어집니다(Precision ↓). 반대로, 정밀도를 높이기 위해 확실한 공격만 탐지하도록 정책을 보수적으로 설정하면(Precision ↑), 일부 애매한 공격을 놓쳐 재현율이 낮아질 수 있습니다(Recall ↓).
Accuracy (정확도)
- “전체 트래픽에 대해 얼마나 정확하게 정상/공격을 분류했는가?”
- 가장 직관적인 지표이지만, 데이터가 불균형할 때(예: 전체 트래픽 중 공격 트래픽이 0.01%뿐일 때) 성능을 왜곡할 수 있어 맹신해서는 안 됩니다.
- \[\text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}\]
ROC Curve와 AUC
- ROC (Receiver Operating Characteristic) 곡선은 모델의 임계값을 변경해가면서 재현율(Y축)과 (1 - 특이도) 또는 오탐율(X축)의 관계를 시각적으로 표현한 그래프입니다.
- 그래프가 좌측 상단에 가까울수록 더 좋은 성능의 모델을 의미합니다.
- AUC (Area Under the Curve)는 이 ROC 곡선 아래의 면적을 의미합니다. 1에 가까울수록 성능이 뛰어난 모델이며, 여러 모델의 성능을 정량적으로 비교하는 데 유용합니다.
결론: 통합 보안 전략의 중요성
지금까지 살펴본 것처럼 방화벽, IDS, IPS는 각각 다른 역할과 강점을 가진 중요한 보안 요소입니다. 어떤 장비 하나가 모든 위협을 막아줄 수는 없습니다.
- 방화벽은 1차 방어선에서 포트/IP 기반으로 불필요한 접근을 막아줍니다.
- IDS는 네트워크를 감시하는 지능적인 ‘탐정’ 역할을 합니다.
- IPS는 위협을 실시간으로 차단하는 ‘경호원’ 역할을 합니다.
현대적인 보안 환경에서는 이 장비들이 생성하는 로그와 이벤트를 SIEM (보안 정보 및 이벤트 관리) 시스템으로 모아 통합적으로 분석하고, 위협에 유기적으로 대응하는 심층 방어(Defense-in-Depth) 전략이 필수적입니다. 결국, 여러 보안 계층이 서로의 약점을 보완하며 시너지를 낼 때 가장 강력한 방어 체계를 구축할 수 있습니다.