Correlation rule

Detection Rule Use Cases — SIEM Multi-Source

Tổng quan

Nguồn log: FortiGate · CheckPoint · pfSense · Linux Audit · WAF Unified
Engine: Custom Detection
Tested: container rules-test — 22/22 rules PASS

RuleNguồnMITRESeverityModeFrequencyLookback
FG-1FortiGateT1595MediumFull Query5m15m
FG-2FortiGateT1190HighWHERE-clause1m5m
FG-3FortiGateT1204HighFull Query5m30m
FG-4FortiGateT1071MediumFull Query5m15m
FG-5FortiGateT1078CriticalFull Query5m20m
CP-1CheckPointT1595/T1498MediumFull Query5m15m
CP-2CheckPointT1190HighWHERE-clause1m5m
CP-3CheckPointT1204/T1071HighWHERE-clause1m5m
CP-4CheckPointT1071/T1567MediumFull Query5m30m
PF-1pfSenseT1595.001MediumFull Query5m15m
PF-2pfSenseT1071/T1095HighWHERE-clause1m5m
PF-3pfSenseT1048HighFull Query5m30m
PF-4pfSenseT1498CriticalFull Query1m5m
LA-1Linux AuditT1110→T1548CriticalFull Query5m20m
LA-2Linux AuditT1003→T1059CriticalFull Query5m60m
WAF-1WAF UnifiedT1190HighFull Query5m15m
WAF-2WAF UnifiedT1190CriticalWHERE-clause1m5m
WAF-3WAF UnifiedT1083CriticalWHERE-clause1m5m
WAF-4WAF UnifiedT1595.003MediumFull Query5m15m
WAF-5WAF UnifiedT1110/T1498HighFull Query5m15m
WAF-6WAF UnifiedT1595.003MediumFull Query10m20m
WAF-7WAF UnifiedT1048HighFull Query5m30m
WAF-8WAF UnifiedT1190CriticalFull Query5m60m

FortiGate Rules


FG-1 — Repeated Deny / Port Scan

Mô tả: Phát hiện IP đang quét nhiều port khác nhau hoặc bị chặn với số lượng lớn — dấu hiệu recon / brute scan.

Kịch bản tấn công: Attacker dò quét dải IP nội bộ để tìm service đang mở trước khi khai thác.

Điều kiện kích hoạt: Cùng source.ip bị deny ≥ 50 lần hoặc trên ≥ 10 port khác nhau trong 10 phút.

Parser fields dùng: event.module, event.action, source.ip, destination.port

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    uniqExact(`destination.port`) AS port_count,
    count()                        AS deny_count,
    min(timestamp)                 AS first_seen,
    max(timestamp)                 AS last_seen
FROM Events
WHERE `event.module`  LIKE 'fortigate%'
  AND `event.action`  = 'denied'
  AND `source.ip`     != ''
  AND timestamp >= now() - INTERVAL 10 MINUTE
GROUP BY `source.ip`
HAVING deny_count >= 50 OR port_count >= 10
ORDER BY deny_count DESC

Test result: 203.0.113.10 → port_count=60, deny_count=60 ✅


FG-2 — IPS Threat from External IP

Mô tả: FortiGate IPS (Intrusion Prevention) phát hiện hoặc chặn tấn công từ IP bên ngoài RFC-1918.

Kịch bản tấn công: Attacker khai thác lỗ hổng (Log4Shell, SQL Injection...) trực tiếp từ internet vào service nội bộ.

Điều kiện kích hoạt: event.module = fortigate.ips + event.action IN (detected, blocked) + IP ngoài private range.

Parser fields dùng: event.module, event.action, source.ip, threat.name

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (WHERE-clause mode):

`event.module`  LIKE 'fortigate.ips%'
AND `event.action` IN ('detected', 'blocked')
AND `source.ip`    != ''
AND NOT isIPAddressInRange(`source.ip`, '10.0.0.0/8')
AND NOT isIPAddressInRange(`source.ip`, '172.16.0.0/12')
AND NOT isIPAddressInRange(`source.ip`, '192.168.0.0/16')

Test result: 2 rows — CVE-2021-44228 Log4Shell, SQL Injection


FG-3 — Antivirus: Same Malware on Multiple Hosts

Mô tả: Cùng một loại malware xuất hiện và bị chặn trên ≥ 2 host — dấu hiệu lây lan nội bộ hoặc phishing campaign rộng.

Kịch bản tấn công: Nhân viên nhận email phishing, mở file đính kèm, malware lây sang nhiều máy qua share drive.

Điều kiện kích hoạt: Cùng threat.name bị block trên ≥ 2 destination.ip khác nhau trong 30 phút.

Parser fields dùng: event.module, event.action, destination.ip, threat.name

Schedule: Frequency = 5 phút | Lookback = 30 phút

Query (Full Query mode):

SELECT
    `threat.name`,
    uniqExact(`destination.ip`)          AS host_count,
    count()                              AS block_count,
    groupArray(DISTINCT `destination.ip`) AS affected_hosts,
    min(timestamp)                       AS first_seen,
    max(timestamp)                       AS last_seen
FROM Events
WHERE `event.module`  = 'fortigate.antivirus'
  AND `event.action`  = 'blocked'
  AND `threat.name`   != ''
  AND timestamp >= now() - INTERVAL 30 MINUTE
GROUP BY `threat.name`
HAVING host_count >= 2
ORDER BY block_count DESC

Test result: Trojan.Generic.XYZ → host_count=3, block_count=3 ✅


FG-4 — Web Filter Bypass Attempt (Repeated Blocks)

Mô tả: Người dùng cố truy cập nhiều trang web bị chặn liên tục — dấu hiệu cố gắng bypass hoặc C2 beaconing.

Kịch bản tấn công: Malware đã cài trên máy tự động gọi về nhiều domain C2, tất cả đều bị webfilter chặn.

Điều kiện kích hoạt: Cùng source.ip + user.name bị webfilter chặn ≥ 10 lần trong 15 phút.

Parser fields dùng: event.module, event.action, source.ip, user.name, url.domain

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `user.name`,
    count()        AS blocked_count,
    groupArray(DISTINCT `url.domain`) AS domains,
    min(timestamp) AS first_seen,
    max(timestamp) AS last_seen
FROM Events
WHERE `event.module`  = 'fortigate.webfilter'
  AND `event.action`  = 'blocked'
  AND `source.ip`     != ''
  AND timestamp >= now() - INTERVAL 15 MINUTE
GROUP BY `source.ip`, `user.name`
HAVING blocked_count >= 10
ORDER BY blocked_count DESC

Test result: 10.0.0.50 / jdoe → blocked_count=12 ✅


FG-5 — Admin Login Brute Force Then Success

Mô tả: IP thực hiện ≥ 3 lần đăng nhập sai vào FortiGate admin, sau đó đăng nhập thành công trong 10 phút.

Kịch bản tấn công: Attacker dò password admin FortiGate, cuối cùng tìm được đúng — toàn bộ firewall bị kiểm soát.

Điều kiện kích hoạt: Cùng IP + user: ≥ 3 logon_failed rồi 1 logon_success trong 10 phút.

Parser fields dùng: event.module, event.action, event.outcome, source.ip, user.name

Schedule: Frequency = 5 phút | Lookback = 20 phút
(Lý do Lookback 20 phút: JOIN INTERVAL 10 MINUTE → Lookback phải > 10 phút)

Query (Full Query mode):

SELECT
    a.`source.ip`,
    a.`user.name`,
    countIf(a.`event.outcome` = 'failure') AS fail_count,
    b.timestamp                            AS success_ts
FROM Events AS a
JOIN Events AS b
    ON  a.`source.ip`  = b.`source.ip`
    AND a.`user.name`  = b.`user.name`
WHERE a.`event.module`  LIKE 'fortigate.event%'
  AND b.`event.module`  LIKE 'fortigate.event%'
  AND a.`event.action`  = 'logon_failed'
  AND b.`event.action`  = 'logon_success'
  AND b.timestamp > a.timestamp
  AND b.timestamp <= a.timestamp + INTERVAL 10 MINUTE
GROUP BY a.`source.ip`, a.`user.name`, b.timestamp
HAVING fail_count >= 3
ORDER BY fail_count DESC

Test result: 192.168.1.99 / admin → fail_count=3 ✅


CheckPoint Rules


CP-1 — High-Volume Deny (Block Storm / DoS Probe)

Mô tả: Một IP bị CheckPoint deny với số lượng rất lớn — dấu hiệu DoS probe hoặc scan toàn bộ service.

Điều kiện kích hoạt: Cùng source.ip bị deny ≥ 100 lần hoặc trên ≥ 15 port khác nhau trong 10 phút.

Parser fields dùng: event.module, event.action, source.ip, destination.port

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    uniqExact(`destination.port`) AS port_count,
    count()                        AS deny_count,
    min(timestamp)                 AS first_seen,
    max(timestamp)                 AS last_seen
FROM Events
WHERE `event.module`   = 'checkpoint'
  AND `event.action`   = 'denied'
  AND `source.ip`      != ''
  AND timestamp >= now() - INTERVAL 10 MINUTE
GROUP BY `source.ip`
HAVING deny_count >= 100 OR port_count >= 15
ORDER BY deny_count DESC

Test result: 198.51.100.77 → port_count=120, deny_count=120 ✅


CP-2 — SmartDefense IPS Attack from External

Mô tả: CheckPoint SmartDefense phát hiện/chặn tấn công khai thác lỗ hổng từ IP bên ngoài.

Kịch bản tấn công: Attacker exploit RDP, SMB, hoặc web vulnerability từ internet.

Điều kiện kích hoạt: observer.product = SmartDefense + event.action IN (blocked, detected) + IP ngoài RFC-1918.

Parser fields dùng: event.module, observer.product, event.action, source.ip, threat.name

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (WHERE-clause mode):

`event.module`  = 'checkpoint'
AND `observer.product` IN ('SmartDefense')
AND `event.action`     IN ('blocked', 'detected')
AND `source.ip`        != ''
AND NOT isIPAddressInRange(`source.ip`, '10.0.0.0/8')
AND NOT isIPAddressInRange(`source.ip`, '172.16.0.0/12')
AND NOT isIPAddressInRange(`source.ip`, '192.168.0.0/16')

Test result: 2 rows — MS-RDP Exploit, Buffer Overflow


CP-3 — Antivirus / Anti-Bot Blocked Threat

Mô tả: CheckPoint AV hoặc Anti-Bot chặn malware hoặc botnet communication trực tiếp.

Kịch bản tấn công: Máy nội bộ bị nhiễm ransomware, hoặc đang kết nối về botnet C2.

Điều kiện kích hoạt: observer.product IN (Anti-Virus, Anti-Bot) + event.action = blocked + threat.name != ''

Parser fields dùng: event.module, observer.product, event.action, threat.name

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (WHERE-clause mode):

`event.module` = 'checkpoint'
AND `observer.product` IN ('Anti-Virus', 'Anti-Bot')
AND `event.action`     = 'blocked'
AND `threat.name`      != ''

Test result: Ransomware.WannaCry (Anti-Virus), BotNet.Emotet (Anti-Bot) ✅


CP-4 — URL Filtering Repeated Blocks (Potential C2)

Mô tả: Cùng user/IP bị URL Filtering chặn nhiều lần — dấu hiệu malware cố kết nối về nhiều C2 domain.

Điều kiện kích hoạt: Cùng source.ip + user.name bị chặn ≥ 5 lần trong 30 phút.

Parser fields dùng: event.module, observer.product, event.action, source.ip, user.name, url.domain

Schedule: Frequency = 5 phút | Lookback = 30 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `user.name`,
    count()                           AS blocked_count,
    groupArray(DISTINCT `url.domain`) AS domains,
    min(timestamp)                    AS first_seen,
    max(timestamp)                    AS last_seen
FROM Events
WHERE `event.module`     = 'checkpoint'
  AND `observer.product` IN ('URL Filtering', 'Application Control')
  AND `event.action`     IN ('blocked', 'denied')
  AND `source.ip`        != ''
  AND timestamp >= now() - INTERVAL 30 MINUTE
GROUP BY `source.ip`, `user.name`
HAVING blocked_count >= 5
ORDER BY blocked_count DESC

Test result: 10.20.0.30 / bob → blocked_count=7 ✅


pfSense Rules


PF-1 — Inbound Port Scan Detection

Mô tả: Phát hiện scan port từ internet vào mạng nội bộ qua pfSense firewall.

Điều kiện kích hoạt: Cùng source.ip, inbound direction, bị deny trên ≥ 10 port khác nhau.

Parser fields dùng: event.module, event.action, network.direction, source.ip, destination.port

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    uniqExact(`destination.port`) AS scanned_ports,
    count()                        AS block_count,
    min(timestamp)                 AS first_seen,
    max(timestamp)                 AS last_seen
FROM Events
WHERE `event.module`      = 'pfsense'
  AND `event.action`      = 'denied'
  AND `network.direction` = 'inbound'
  AND `source.ip`         != ''
  AND timestamp >= now() - INTERVAL 10 MINUTE
GROUP BY `source.ip`
HAVING scanned_ports >= 10
ORDER BY scanned_ports DESC

Test result: 45.132.192.10 → scanned_ports=20, block_count=20 ✅


PF-2 — Outbound Connection to Known C2 Ports

Mô tả: Máy nội bộ cố kết nối ra ngoài trên các port thường dùng bởi reverse shell và C2 framework.

Kịch bản tấn công: Attacker đã cài backdoor, máy nạn nhân mở kết nối ra cổng 4444 (Metasploit default), 1337, 31337...

Điều kiện kích hoạt: Outbound TCP bị deny đến các C2 port đặc trưng.

Parser fields dùng: event.module, event.action, network.direction, network.transport, destination.port

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (WHERE-clause mode):

`event.module`        = 'pfsense'
AND `event.action`    = 'denied'
AND `network.direction` = 'outbound'
AND `network.transport` = 'tcp'
AND `destination.port` IN (4444, 4445, 1337, 31337, 8080, 9090, 6666, 6667, 6668)

Test result: 3 rows — port 4444, 1337, 31337 ✅


PF-3 — Large Outbound Data Transfer (Exfiltration)

Mô tả: Tổng lượng bytes outbound từ một IP đến một destination bên ngoài vượt ngưỡng — dấu hiệu data exfiltration.

Kịch bản tấn công: Attacker steal data qua HTTPS (port 443), gửi database dump ra ngoài.

Điều kiện kích hoạt: Cùng source.ipdestination.ip (external), tổng network.bytes ≥ 50 MB trong 30 phút.

Parser fields dùng: event.module, event.action, network.direction, network.bytes, source.ip, destination.ip

Schedule: Frequency = 5 phút | Lookback = 30 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `destination.ip`,
    `destination.port`,
    `network.transport`,
    sum(`network.bytes`)  AS total_bytes,
    count()               AS packet_count,
    min(timestamp)        AS first_seen,
    max(timestamp)        AS last_seen
FROM Events
WHERE `event.module`      = 'pfsense'
  AND `event.action`      = 'allowed'
  AND `network.direction` = 'outbound'
  AND `network.bytes`     > 0
  AND NOT isIPAddressInRange(`destination.ip`, '10.0.0.0/8')
  AND NOT isIPAddressInRange(`destination.ip`, '172.16.0.0/12')
  AND NOT isIPAddressInRange(`destination.ip`, '192.168.0.0/16')
  AND timestamp >= now() - INTERVAL 30 MINUTE
GROUP BY `source.ip`, `destination.ip`, `destination.port`, `network.transport`
HAVING total_bytes >= 50000000
ORDER BY total_bytes DESC

Test result: 192.168.1.200203.0.113.200, total_bytes=70,000,000 ✅


PF-4 — DDoS Attack Spike

Mô tả: Lượng kết nối bị chặn vào cùng destination vượt ngưỡng lớn từ nhiều nguồn — dấu hiệu DDoS.

Điều kiện kích hoạt: Cùng destination.ip:port, inbound, ≥ 500 gói bị deny từ ≥ 10 source IP khác nhau trong 5 phút.

Parser fields dùng: event.module, event.action, network.direction, destination.ip, destination.port, source.ip

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (Full Query mode):

SELECT
    `destination.ip`,
    `destination.port`,
    `network.transport`,
    count()                AS block_count,
    uniqExact(`source.ip`) AS source_count,
    min(timestamp)         AS first_seen
FROM Events
WHERE `event.module`      = 'pfsense'
  AND `event.action`      = 'denied'
  AND `network.direction` = 'inbound'
  AND timestamp >= now() - INTERVAL 5 MINUTE
GROUP BY `destination.ip`, `destination.port`, `network.transport`
HAVING block_count >= 500 AND source_count >= 10
ORDER BY block_count DESC

Test result: 192.168.1.10:80 → block_count=600, source_count=600 ✅


Linux Audit Rules


LA-1 — Brute Force Auth → Privilege Escalation (Chained Attack)

Mô tả: Chuỗi tấn công 2 bước: dò mật khẩu SSH/PAM (≥ 3 lần thất bại), sau khi đăng nhập được thì leo quyền lên root qua sudo/su trong 10 phút.

Kịch bản tấn công: Attacker brute force SSH → vào được với quyền thường → ngay lập tức chạy sudo để lấy root.

Điều kiện kích hoạt: Cùng user.name + host.hostname: ≥ 3 user_auth failure + 1 syscall success với user.effective.id=0 trong 10 phút.

Parser fields dùng: event.module, event.action, event.outcome, user.name, host.hostname, user.effective.id, user.audit.id, process.name

Schedule: Frequency = 5 phút | Lookback = 20 phút
(JOIN INTERVAL 10 MINUTE → Lookback phải > 10 phút)

Query (Full Query mode):

SELECT
    fail.`user.name`,
    fail.`host.hostname`,
    countIf(fail.`event.outcome` = 'failure') AS auth_fail_count,
    priv.`process.name`                        AS escalation_via,
    priv.timestamp                             AS escalation_time
FROM Events AS fail
JOIN Events AS priv
    ON  fail.`user.name`     = priv.`user.name`
    AND fail.`host.hostname` = priv.`host.hostname`
WHERE fail.`event.module`  = 'auditd'
  AND fail.`event.action`  = 'user_auth'
  AND fail.`event.outcome` = 'failure'
  AND priv.`event.action`  = 'syscall'
  AND priv.`event.outcome` = 'success'
  AND priv.`user.effective.id` = '0'
  AND priv.`user.audit.id`     != '0'
  AND priv.timestamp > fail.timestamp
  AND priv.timestamp <= fail.timestamp + INTERVAL 10 MINUTE
GROUP BY fail.`user.name`, fail.`host.hostname`, priv.`process.name`, priv.timestamp
HAVING auth_fail_count >= 3
ORDER BY auth_fail_count DESC

Test result: alice / server-01 → auth_fail_count=3, escalation_via=sudo ✅


LA-2 — Credential Acquisition → Suspicious Execution

Mô tả: Ngay sau khi CRED_ACQ (hệ thống cấp credential mới), process chạy binary từ /tmp, /dev/shm, hoặc interpreter như python/perl trong 2 phút — dấu hiệu credential theft chạy payload.

Kịch bản tấn công: Attacker sau khi vào được server, dùng sudo để acquire credential, sau đó chạy script python hoặc binary trong /tmp để dump thêm credential hoặc mở backdoor.

Điều kiện kích hoạt: Cùng user.audit.id + host.hostname: credential_acquired success rồi execve /tmp/... trong 2 phút.

Parser fields dùng: event.module, event.action, event.outcome, user.audit.id, host.hostname, process.executable

Schedule: Frequency = 5 phút | Lookback = 65 phút
(JOIN dùng cred.timestamp >= now() - INTERVAL 1 HOUR → Lookback phải ≥ 60 phút)

Query (Full Query mode):

SELECT
    cred.`user.audit.id`,
    cred.`host.hostname`,
    cred.timestamp                                             AS cred_time,
    exec.`process.executable`                                 AS command_run,
    exec.timestamp                                            AS exec_time,
    dateDiff('second', cred.timestamp, exec.timestamp)        AS gap_seconds
FROM Events AS cred
JOIN Events AS exec
    ON  cred.`user.audit.id` = exec.`user.audit.id`
    AND cred.`host.hostname` = exec.`host.hostname`
WHERE cred.`event.module`  = 'auditd'
  AND cred.`event.action`  = 'credential_acquired'
  AND cred.`event.outcome` = 'success'
  AND exec.`event.action`  = 'execve'
  AND (
      exec.`process.executable` LIKE '/tmp/%'
      OR exec.`process.executable` LIKE '/dev/shm/%'
      OR exec.`process.executable` LIKE '%/python%'
      OR exec.`process.executable` LIKE '%/perl%'
      OR exec.`process.executable` LIKE '%/ruby%'
  )
  AND exec.timestamp > cred.timestamp
  AND exec.timestamp <= cred.timestamp + INTERVAL 2 MINUTE
  AND cred.timestamp >= now() - INTERVAL 1 HOUR
ORDER BY cred_time DESC

Test result: 1002 / server-02/tmp/payload.elf, gap_seconds=30 ✅


WAF Unified Rules


WAF-1 — Multi-Threat Detection from Single IP

Mô tả: Cùng IP kích hoạt WAF alert nhiều lần, có thể kết hợp nhiều loại attack — dấu hiệu tấn công có chủ đích (targeted attack).

Kịch bản tấn công: Attacker dùng tool tự động (sqlmap, nikto, burp suite) quét web app, trigger nhiều loại detection.

Điều kiện kích hoạt: Cùng source.ip → cùng url.domain, event.action = threat_detected ≥ 3 lần trong 10 phút.

Parser fields dùng: event.action, source.ip, url.domain, threat.type

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `url.domain`,
    count()                            AS threat_count,
    groupArray(DISTINCT `threat.type`) AS threat_types,
    groupArray(DISTINCT `url.full`)    AS attacked_paths,
    min(timestamp)                     AS first_seen,
    max(timestamp)                     AS last_seen
FROM Events
WHERE `event.action` = 'threat_detected'
  AND `source.ip`    != ''
  AND timestamp >= now() - INTERVAL 10 MINUTE
GROUP BY `source.ip`, `url.domain`
HAVING threat_count >= 3
ORDER BY threat_count DESC

Test result: 45.33.32.156 → app.example.com → threat_count=9, types=SQL_INJECTION, PATH_TRAVERSAL, XSS


WAF-2 — SQL Injection Attack

Mô tả: WAF phát hiện SQL Injection — mỗi event là một cuộc tấn công thực sự, không cần aggregate.

Kịch bản tấn công: Attacker inject ' OR 1=1 --, UNION SELECT, '; DROP TABLE vào form/URL để dump database.

Điều kiện kích hoạt: event.action = threat_detected AND threat.type LIKE '%SQL_INJECTION%'

Parser fields dùng: event.action, threat.type, source.ip, url.full

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (WHERE-clause mode):

`event.action` = 'threat_detected'
AND `threat.type` LIKE '%SQL_INJECTION%'
AND `source.ip`   != ''

Test result: 5 distinct events từ 2 IPs (45.33.32.156, 91.108.4.10) ✅


WAF-3 — Path Traversal Attack

Mô tả: Attacker cố truy cập file ngoài web root qua ../../etc/passwd, ../../../etc/shadow...

Kịch bản tấn công: Khai thác Local File Inclusion (LFI) — đọc config, private key, /etc/shadow của server.

Điều kiện kích hoạt: event.action = threat_detected AND threat.type LIKE '%PATH_TRAVERSAL%'

Parser fields dùng: event.action, threat.type, source.ip, url.full

Schedule: Frequency = 1 phút | Lookback = 5 phút

Query (WHERE-clause mode):

`event.action` = 'threat_detected'
AND `threat.type` LIKE '%PATH_TRAVERSAL%'
AND `source.ip`   != ''

Test result: 185.156.73.51 → /api/file?path=../../etc/passwd, /download?file=../../../etc/shadow


WAF-4 — HTTP 4xx Error Spike (Scanner / Fuzzer)

Mô tả: IP nhận quá nhiều 4xx response — dấu hiệu đang dùng wordlist-based fuzzer (ffuf, gobuster, DirBuster) để tìm endpoint ẩn.

Kịch bản tấn công: Attacker brute-force URL path để tìm admin panel, backup file, debug endpoint.

Điều kiện kích hoạt: Cùng IP nhận ≥ 100 response 4xx (404/403/401) trong 10 phút.

Parser fields dùng: event.action, http.response.status_code, source.ip, url.full, url.domain

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `url.domain`,
    count()               AS error_count,
    uniqExact(`url.full`) AS distinct_paths,
    min(timestamp)        AS first_seen,
    max(timestamp)        AS last_seen
FROM Events
WHERE `event.action`              = 'access'
  AND `http.response.status_code` >= 400
  AND `http.response.status_code` <  500
  AND `source.ip`                 != ''
  AND timestamp >= now() - INTERVAL 10 MINUTE
GROUP BY `source.ip`, `url.domain`
HAVING error_count >= 100
ORDER BY error_count DESC

Test result: 103.21.244.0 → target.example.com → error_count=110, distinct_paths=110 ✅


WAF-5 — Rate Limit Spike (Brute Force / Layer-7 DDoS)

Mô tả: IP bị rate-limit liên tục — dấu hiệu brute force (login/API) hoặc tấn công flood Layer 7.

Kịch bản tấn công: Bot thực hiện credential stuffing vào /api/login, vượt quá rate limit mỗi giây.

Điều kiện kích hoạt: Cùng IP bị rate_limited ≥ 50 lần trong 5 phút.

Parser fields dùng: event.action, source.ip, url.domain

Schedule: Frequency = 5 phút | Lookback = 15 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `url.domain`,
    count()        AS rate_limit_count,
    min(timestamp) AS first_seen,
    max(timestamp) AS last_seen
FROM Events
WHERE `event.action` = 'rate_limited'
  AND `source.ip`    != ''
  AND timestamp >= now() - INTERVAL 5 MINUTE
GROUP BY `source.ip`, `url.domain`
HAVING rate_limit_count >= 50
ORDER BY rate_limit_count DESC

Test result: 1.32.232.243 → api.example.com → rate_limit_count=55 ✅


WAF-6 — URL Scanning (Web Fuzzer / Directory Enumeration)

Mô tả: Cùng IP truy cập số lượng lớn URL path khác nhau — đặc trưng của wordlist scan.

Kịch bản tấn công: Tool như ffuf, wfuzz, gobuster gửi hàng nghìn request đến các path từ wordlist để tìm endpoint ẩn, backup file.

Điều kiện kích hoạt: Cùng IP request ≥ 50 url.full khác nhau trong 15 phút.

Parser fields dùng: event.action, source.ip, url.full, url.domain, http.response.status_code

Schedule: Frequency = 10 phút | Lookback = 20 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `url.domain`,
    uniqExact(`url.full`)                       AS distinct_paths,
    count()                                     AS total_requests,
    countIf(`http.response.status_code` >= 400) AS error_count,
    min(timestamp)                              AS first_seen,
    max(timestamp)                              AS last_seen
FROM Events
WHERE `event.action` = 'access'
  AND `source.ip`    != ''
  AND `url.full`     != ''
  AND timestamp >= now() - INTERVAL 15 MINUTE
GROUP BY `source.ip`, `url.domain`
HAVING distinct_paths >= 50
ORDER BY distinct_paths DESC

Test result: 5.188.86.172 → scan-target.example.com → distinct_paths=60, total_requests=60 ✅


WAF-7 — Large Data Response (Data Exfiltration via API)

Mô tả: Tổng response bytes từ cùng IP đến cùng endpoint vượt ngưỡng 100 MB — dấu hiệu dump data qua API.

Kịch bản tấn công: Attacker đã compromise API key hoặc session, gọi /api/export nhiều lần để lấy toàn bộ database.

Điều kiện kích hoạt: Cùng source.ip + url.full, tổng destination.bytes ≥ 100 MB, response 2xx trong 30 phút.

Parser fields dùng: event.action, source.ip, url.full, destination.bytes, http.response.status_code

Schedule: Frequency = 5 phút | Lookback = 30 phút

Query (Full Query mode):

SELECT
    `source.ip`,
    `url.full`,
    `url.domain`,
    sum(`destination.bytes`) AS total_bytes,
    count()                  AS request_count,
    min(timestamp)           AS first_request,
    max(timestamp)           AS last_request
FROM Events
WHERE `event.action`              = 'access'
  AND `destination.bytes`         > 0
  AND `http.response.status_code` >= 200
  AND `http.response.status_code` <  300
  AND `source.ip`                 != ''
  AND timestamp >= now() - INTERVAL 30 MINUTE
GROUP BY `source.ip`, `url.full`, `url.domain`
HAVING total_bytes >= 104857600
ORDER BY total_bytes DESC

Test result: 192.168.100.50 → /api/v1/export/full-database → total_bytes=160,000,000 (160 MB) ✅


WAF-8 — Threat Detected Then Successful Access (WAF Bypass Attempt)

Mô tả: WAF phát hiện tấn công từ IP, nhưng sau đó IP đó vẫn nhận response 2xx trên cùng domain — khả năng attacker đã điều chỉnh payload và bypass được WAF.

Kịch bản tấn công: Attacker bị WAF chặn lần đầu (SQL injection), thay đổi encoding/encoding/obfuscation, gửi lại request → WAF miss → server trả 200 OK.

Điều kiện kích hoạt: Cùng source.ip + url.domain: ≥ 1 threat_detected event, rồi access với HTTP 2xx trong 10 phút tiếp theo.

Parser fields dùng: event.action, source.ip, url.domain, url.full, http.response.status_code, threat.type

Schedule: Frequency = 5 phút | Lookback = 65 phút
(JOIN + now() - INTERVAL 1 HOUR → Lookback phải ≥ 60 phút)

Query (Full Query mode):

SELECT
    t.`source.ip`,
    t.`url.domain`,
    count()                              AS threat_count,
    groupArray(DISTINCT t.`threat.type`) AS threat_types_seen,
    ok.timestamp                         AS bypass_time,
    ok.`url.full`                        AS bypassed_path,
    ok.`http.response.status_code`       AS response_code
FROM Events AS t
JOIN Events AS ok
    ON  t.`source.ip`  = ok.`source.ip`
    AND t.`url.domain` = ok.`url.domain`
WHERE t.`event.action`               = 'threat_detected'
  AND ok.`event.action`              = 'access'
  AND ok.`http.response.status_code` >= 200
  AND ok.`http.response.status_code` <  300
  AND ok.timestamp > t.timestamp
  AND ok.timestamp <= t.timestamp + INTERVAL 10 MINUTE
  AND t.timestamp >= now() - INTERVAL 1 HOUR
GROUP BY t.`source.ip`, t.`url.domain`, ok.timestamp, ok.`url.full`, ok.`http.response.status_code`
HAVING threat_count >= 1
ORDER BY bypass_time DESC

Test result: 78.111.0.50 → vuln-app.example.com → threat_count=2, bypassed_path=/admin/exec, response_code=200 ✅