Cyber / plan.md
pramodkachare's picture
Upload project files (excluding raw/derived dataset and venv)
aefa98b verified
|
Raw History Blame Contribute Delete
23.4 kB
# MTech Thesis & Journal Paper Plan (v4, after literature review and data audit steps 01-04)
## Source Confounding and Valid Evaluation Protocols for Multi-Class NIDS on BigFlow-NIDS-V2
> v4 supersedes v3. v3 came from the literature review (`slr/SLR_REPORT.md`, `slr/NOVELTY_RECHECK.md`). v4 adds what the first four implementation steps showed (`impl/artifacts/step01..04`): **27 of 32 classes occur in exactly one source dataset**, so class identity is confounded with source, a 31-class leave-one-source-out (LOSO) is impossible, and a source-wide time split leaves most attacks without train or test data. The thesis is therefore reframed around **quantifying that confounding and defining the evaluation protocols that remain valid**, then benchmarking on them. Positioning remains a benchmark / re-evaluation study, not a new method.
---
## 1. Context and positioning
**Dataset.** BigFlow-NIDS-V2 (Uddin, Arefin, Hussain, *Data in Brief* 65, 2026): 66,935,021 flows, 55 attributes, 32 labels = Benign + 31 attack classes, merged from NF-UNSW-NB15-v3, NF-ToN-IoT-v3, NF-BoT-IoT-v3, NF-CSE-CIC-IDS2018-v3. Verified facts:
- The 55 features include **IPs, ports and absolute timestamps** (leakage-prone). The dataset paper has **no model results** (only load times), so there is no baseline to reproduce. Its prose disagrees with its Table 2; the **data matches Table 2 exactly** (step 02).
- Row order is interleaved, not four sequential blocks. **Source is attributed by capture date** (2015 = UNSW, 2019 = ToN-IoT, Feb-Mar 2018 = CSE-CIC-2018, May-Jun 2018 = BoT-IoT) and validated against testbed IP plans: 0 unassigned flows (step 03).
- **Source sizes and benign share:** ToN-IoT 27.52M (61.0% benign), CSE-CIC-2018 20.12M (87.1%), BoT-IoT 16.93M (0.31%), UNSW 2.37M (94.6%).
- Only 238 of 225,446 distinct IPs appear in more than one source: **IPs are near-perfect source fingerprints**.
- **Class-by-source (step 04):** 27 of 32 classes are single-source; only Benign (4 sources), DoS (3), DDoS (2), Reconnaissance (2), Backdoor (2) are shared. **Source alone gives 79.8% binary and 66.6% 32-class accuracy** (majority class: 54.7%); NMI(source, class) = 0.426.
- **Duplicates (step 05):** 3.67% exact duplicates on feature set A (2.46M rows; only 880 rows with conflicting labels; "no cross-source duplicates" is tautological because A contains the timestamps that define the source). On feature set B (no IPs/ports/timestamps) **66.6% of rows are duplicates, 23.0% of rows share their B-features with a different label, and 11.2% share them across sources**; FTP-BruteForce and DoS_attacks-SlowHTTPTest collapse to a single distinct B vector (100% label-conflicting) and Brute_Force_-XSS to 66.
- **Source identifiability (step 06):** a LightGBM identifies the source with **99.91% accuracy on feature set B** (47 features without IPs, ports and timestamps; 100% on A is tautological because A includes the timestamps that define the source). Within one class it still reaches 99.78% (Benign), 99.98% (DoS) and 100.0% (DDoS). No single feature exceeds 83% (best: OUT_BYTES), so **feature set C = B** by the pre-stated rule. Ablation: removing the 20 most informative features leaves 99.47%; with only 7 features left it is still 95.2%. One 70/30 split per probe (no repeats).
- **Protocol evaluability (step 07 v2, population 64,475,595 unique flow-label pairs; feature set A / B in brackets):** P1 31 / 26 of 32 labels, P2 30 / 26, **P3 3 / 3** (attacks come from very few source IPs, e.g. DoS 19, DDoS 14, Reconnaissance 12, most other classes 4 or fewer, so source-IP group splits cannot be evaluated for almost any attack class; only Benign, Brute_Force_-Web and Infilteration have >= 5 train and >= 5 test IPs), P4 4/4/4/1 (UNSW/ToN/BoT/CSE; CSE has only Benign and is flagged degenerate, not scored), **P5 family LOSO (taxonomy v1) 5/6/3/5 of 12** (v0: 4/6/4/6 of 9). Under B, Brute_Force_-XSS, DoS_attacks-SlowHTTPTest, FTP-BruteForce, SQL_Injection, Theft and Worms drop out of P1/P2 because their clean test rows or distinct training vectors fall below the thresholds. **The extreme tail named in the plan (Worms 158, SQL_Injection 440, Brute_Force_XSS 480) cannot be scored under valid B protocols.** Test rows with B-hash occurring in train (same label = leakage; other label = conflict): P1 6.50M + 0.01M of 9.67M, P2 3.00M + 0.08M of 8.90M, P3 1.69M + 0.02M of 8.40M, and for the binary LOSO on ToN-IoT 5.38M + 1.02M of 25.7M (identical flows across sources).
- Two numeric columns contain `inf`/empty from divide-by-zero on zero-duration flows (`SRC/DST_TO_SRC_SECOND_BYTES`, up to 1.75%); missingness is class-informative (Reconnaissance 41%, Generic 76%, Benign 0.3%).
**Gap (verified with caveats, Sec. 3).** No work found that uses BigFlow-NIDS-V2 beyond the dataset record, and none that quantifies class-source confounding of the merged corpus, defines which protocols are valid on it, or compares loss-level and resampling methods on its extreme tail under such protocols.
**Thesis claim.** On a merged multi-source flow corpus, headline accuracy mostly measures source identity. Only a restricted set of protocols is valid; stating exactly which classes each protocol can evaluate, and benchmarking models and rare-class strategies under those protocols, changes the conclusions drawn from the corpus.
---
## 2. Research questions
| RQ | Question | Priority |
|---|---|---|
| RQ1 | **Merge audit.** How strongly are class, source and shortcut features (IPs, ports, timestamps, TTL, `inf` missingness, zero-duration flows, duplicates) confounded in BigFlow-NIDS-V2, and how much of model accuracy do they explain? (Source-only baselines, source-predictability probes, duplicate and cross-source overlap.) | Primary |
| RQ2 | **Valid protocols and benchmark.** Which evaluation protocols remain valid on this corpus, what exactly can each evaluate (the *evaluability matrix*), and how do strong baselines perform under them: dedup'd random (reference), per-class chronological hold-out, source-IP-group hold-out, shared-class LOSO, binary LOSO and family-level LOSO? | Primary |
| RQ3 | **Imbalance.** Under the valid protocols, do loss-level methods (class weights, focal, class-balanced, logit adjustment) beat resampling (undersampling, SMOTE variants) on the extreme tail (Worms 158, SQL_Injection 440, Brute_Force_XSS 480)? Which gains survive confidence intervals? | Primary |
| RQ4 | **Scale.** How does accuracy saturate with training fraction (1-100%), and what does Spark buy in runtime? | Primary |
| RQ5 | **Hierarchy (secondary).** Does binary -> family -> fine-grained beat a flat model end to end and on rare classes? | Secondary |
---
## 3. Novelty status (literature review result, unchanged except C1/C2 wording)
**Method and limits.** OpenAlex (84 queries, 10 themes, 2015-2026) plus Crossref/arXiv re-checks. **Scopus and Web of Science were not searched** (student to run `slr/search_log.csv`). Screening was LLM abstract-level (recall unmeasured); 9 of 10 flagged papers were read from abstracts only; two of five novelty angles were inconclusive. Absence of evidence, not proof.
| Contribution | Closest prior art | Status |
|---|---|---|
| C1 Merge audit (class-source confounding, shortcuts, duplicates) | Source-identifiability and shortcut papers on single or paired NetFlow sources (domain AUC >= 0.996 on all four NF-v3 sets in "Is It Transfer?"; 99.96% source identifiability on two v2 sets; ToN-IoT 65.7% duplicates; CICIDS2017/2018 audits) | **Concept not novel.** Open: quantification on the *merged BigFlow corpus* (class x source table, source-only baselines, IP fingerprints) |
| C2 Evaluability matrix and valid protocols | Cross-dataset studies mostly binary, 2-3 sources, v1/v2 or non-NetFlow; NF-v3 random/temporal/source-entity splits (binary/host-window); time-based long-tail study on single v2 sets | **Partially novel**; now a descriptive-plus-protocol contribution, not a "31-class LOSO benchmark" |
| C3 Imbalance strategies | 42 resampling combos on NF-v1 (resampling does not reliably help); 2026 long-tail/cost-sensitive NIDS papers (unread) | **Partially novel**; cluster-SMOTE claim dropped |
| C4 Spark scalability | Spark MLlib on full BoT-IoT (73M, two sizes); Spark/Kafka cross-dataset ensemble | **Weak**; only a learning-curve study differentiates |
| C5 Hierarchy | 3-level vs flat on NSL-KDD/UNSW/CIC-DoS2017: no significant difference; HICID and others (abstract/title only) | **Largely done; secondary** |
**Biggest risk: being scooped** (monthly 2026 releases in this niche). Mitigations in Sec. 9.
---
## 4. Contributions (examinable)
1. **C1:** quantified audit of the merged corpus: class-source confounding (27/32 single-source; source-only accuracy), IP/port/timestamp/TTL fingerprints, `inf` missingness, zero-duration flows, duplicates (within and cross source), with a cleaned and documented split definition.
2. **C2:** an *evaluability matrix* (what each protocol can and cannot evaluate, per class and source) and a set of valid, frozen protocols, with baseline results under them.
3. **C3:** controlled loss-level vs resampling comparison on the extreme tail, with confidence intervals, under the valid protocols.
4. **C4:** learning-curve evidence on how much of the 66.9M rows is needed.
5. **C5 (secondary):** test of whether "hierarchy does not help" holds on this long-tailed set.
Not claimed: a new architecture, cluster-SMOTE, "first leakage/shortcut study on NetFlow", "first Spark NIDS", or a 31-class LOSO.
---
## 5. Methodology
### Pipeline (implemented as numbered, re-runnable steps in `impl/src/pipeline/`)
| Step | Content | Status |
|---|---|---|
| 01 | CSV -> typed Parquet, `row_id` = original order | done |
| 02 | Inventory: labels vs Table 2, nulls/`inf`, columns, timestamps | done |
| 03 | Source attribution (capture date) + validation | done |
| 04 | Class x source table, source-label confounding, LOSO / time-split coverage | done |
| 05 | Duplicates: exact within/cross source, label-conflicting duplicates, feature-set variants | done |
| 06 | Source-predictability probe, ablation curve, feature-set C rule | done (C = B: rule dropped nothing) |
| 07a | ATT&CK grounding (Enterprise v20.0) and Taxonomy v1 | done |
| 07 | Frozen split protocols (v2 after adversarial review), leak flags, evaluability matrix | done |
| 08 | Baselines under the protocols (RQ2) | done (+08b noise floor) |
| 09 | Imbalance study (RQ3) | done |
| 10 | Learning curve and Spark scalability (RQ4) | done (see CLAUDE.md for the f=1.0 rerun) |
| 11 | Hierarchy experiment (RQ5, secondary) | done |
| 12 | Tables and figures for thesis and paper | planned |
### Feature-set variants (used everywhere)
- **A:** all 53 features (everything except `Label`, `Attack`, `row_id`, `source`), including IPs, ports, timestamps.
- **B:** A minus IPv4 source/destination, L4 source/destination port, flow start/end timestamps (47 features).
- **C:** B minus features that identify the source on their own (rule fixed beforehand: single-feature source accuracy >= 0.90). **Result: no feature qualifies, so C = B and later steps use A and B only.** Source identifiability is distributed across many features (ablation curve, step 06).
- `inf` -> NaN (trees); neural nets use 0 + indicator; results reported with and without the indicator.
### Phase 1: Audit (RQ1; steps 02-06)
Source-only baselines, source-predictability probes (overall and within Benign / DoS / DDoS), cross-source IP overlap, duplicates (exact on A; on B; label-conflicting), class-wise missingness shortcuts.
### Phase 2: Protocols (RQ2; step 07, frozen before modelling)
Population: deduplicated on feature set A (first occurrence by `row_id`). For B/C experiments, test rows whose B-hash occurs in train are flagged and excluded from the test score.
| Protocol | Definition | Valid for |
|---|---|---|
| P1 random (reference) | stratified 70/15/15 within (source, class) | comparison with literature only (inflated by design) |
| P2 per-class chronological | within each (source, class) stream, first 70% / next 15% / last 15% by start time, with a 5-minute embargo around boundaries | classes with enough flows in each window (all multi-day and long classes) |
| P3 source-IP group | within each class, split by `IPV4_SRC_ADDR` group so no attacker IP crosses splits; evaluable only with >= 5 train and >= 5 test IPs and top-IP share <= 50% | **3 labels only** (reported as a finding: attacks originate from very few IPs) |
| P4 shared-class LOSO | train on three sources, test on the held-out one, only classes passing MIN_TRAIN/MIN_TEST (Benign, DoS, DDoS, Reconnaissance, Backdoor; CSE-CIC-2018 supports only Benign) | the shared classes only |
| P4b binary LOSO | benign vs any attack, held-out source | all four sources |
| P5 family LOSO | **Taxonomy v1 (MITRE ATT&CK grounded, step 07a)** families, held-out source, families passing the thresholds; v0 kept for sensitivity (p5v0) | families present in at least two sources |
Thresholds: MIN_TRAIN = 100, MIN_TEST = 50 flows. Rare-class results use repeated CV (>= 5 repeats), bootstrap confidence intervals and a minimum-support rule. A source-wide time split is **not** used (it leaves 8 classes without a train window).
### Phase 3: Baselines (RQ2; step 08)
Flat LightGBM / XGBoost (class-weighted; GPU where useful), Random Forest, MLP, one tabular-DL baseline (TabNet or FT-Transformer, sampled). Spark MLlib `GBTClassifier` is binary-only: use XGBoost4J-Spark / LightGBM-on-Spark, `OneVsRest` or RandomForest. Metrics: macro-F1, MCC, balanced accuracy, per-class P/R/F1 with CIs; accuracy is reported but not used for conclusions. Every score is reported next to the **source-only baseline** and the majority baseline.
### Phase 4: Taxonomy (needed for P5 and RQ5; step 07a)
**Taxonomy v1 is grounded in MITRE ATT&CK Enterprise v20.0.** Each (source, label) was mapped to techniques whose ids, names and tactics were looked up in the official STIX file; the behaviour of each attack was quoted from the dataset papers by extraction agents, and a second skeptic pass corrected 27 of 36 rows (mostly technique specificity and over-stated confidence). Rule: family = ATT&CK technique cluster of the label's primary technique (11 families: DENIAL_OF_SERVICE, RECON_DISCOVERY, CREDENTIAL_ACCESS, EXPLOIT_PUBLIC_APP, COMMAND_AND_CONTROL, LATERAL_MOVEMENT, EXECUTION, RANSOMWARE_IMPACT, EXFILTRATION, CLIENT_INITIAL_ACCESS, UNMAPPED). Confidence: 6 rows high, 14 medium, 16 low (several UNSW classes are one-line umbrellas in the papers; `Generic` has no ATT&CK counterpart). Differences from the provisional v0 (adjusted Rand index 0.69 over the 31 classes, 0.996 flow-weighted): Fuzzers go to DENIAL_OF_SERVICE (ATT&CK has no fuzzing technique; skeptic judged T1499.004 primary), mitm joins CREDENTIAL_ACCESS, Analysis joins EXPLOIT_PUBLIC_APP, and Worms, Shellcode, ransomware, Theft, Infilteration become singletons. Backdoor resolves to COMMAND_AND_CONTROL by an explicit override (UNSW and ToN-IoT map differently, both low confidence). Limits: ATT&CK describes adversary behaviour, not flow statistics (flow observability recorded per row); quotes were re-checked by a skeptic agent, not by a human. P5 is reported under both taxonomies; an empirical (confusion-based) grouping is still to be compared in step 12.
### Phase 5: Imbalance study (RQ3; step 09)
Loss-level: inverse-frequency and effective-number weights, focal, class-balanced, logit adjustment. Data-level: undersampling, SMOTE, Borderline-SMOTE, SVM-SMOTE, KMeans-SMOTE, SMOTE-ENN (training folds only). Same models, protocols and seeds for every method; realism checks on synthetic flows.
### Phase 6: Scale study (RQ4; step 10)
Learning curves at 1/5/10/25/50/100% of training data (class floors so rare classes survive); runtime and throughput vs fraction and executors on a named cluster.
### Phase 7 (secondary): Hierarchy (RQ5; step 11)
Flat vs 3-tier cascade vs family-conditional Tier 3; end-to-end metrics, error propagation, rare-class recall, hierarchical F1. No learned gating model.
---
## 6. Thesis chapter structure
| Ch. | Title | Pages |
|---|---|---|
| 1 | Introduction: NIDS at scale, evaluation validity, gap, RQs, contributions | 15 |
| 2 | Literature Review (SLR-based) | 28 |
| 3 | BigFlow-NIDS-V2 Audit: sources, confounding, shortcuts, duplicates (RQ1) | 25 |
| 4 | Valid Protocols and the Evaluability Matrix; Baselines (RQ2) | 28 |
| 5 | Imbalance Study (RQ3) | 20 |
| 6 | Scalability Study (RQ4) | 12 |
| 7 | Hierarchy as a Secondary Experiment (RQ5) | 10 |
| 8 | Discussion, Limitations, Conclusion | 10 |
Typeset with the IIT Bombay report class (`thesis/`); the student confirmed the format is acceptable.
---
## 7. Journal paper
### Positioning
Benchmark / re-evaluation paper. Lead with the BigFlow-specific findings: class-source confounding, the evaluability matrix, and results under valid protocols.
### Working title
> "What Does a 66-Million-Flow Merge Hide? Source Confounding and Valid Evaluation Protocols for Multi-Class Intrusion Detection on BigFlow-NIDS-V2"
### Venue options (verify indexing, scope and APC on the live Scopus/WoS lists first)
- **Institute rule (photographed notice):** journals on the institute list, **or any journal/conference indexed in Scopus or Web of Science**.
- **Institute list, relevant:** IJAISC (Inderscience), Intelligent Decision Technologies (IOS Press); listed as no-APC, verify current Scopus status.
- **Stronger fits (Scopus/WoS-indexed):** Computers & Security, Journal of Network and Computer Applications, Computer Networks, Journal of Big Data, Cluster Computing, Future Generation Computer Systems, Expert Systems with Applications; fast fallback: IEEE Access.
- Check that the venue accepts benchmark/reproducibility papers.
### Timing
Submit by **Month 8-9**; confirm whether the institute needs "submitted", "accepted" or "published" for thesis submission.
---
## 8. Timeline (12 months)
| Month | Milestone |
|---|---|
| 1 | Steps 01-07 (data audit, protocols); retrieve paywalled papers; **re-run `slr/search_log.csv` in Scopus and Web of Science**; snowball citations; confirm cluster |
| 2 | Step 08 baselines; Ch. 2 draft from the review; Ch. 3 draft from audit results |
| 3 | Audit complete (RQ1). **Gate 1:** are the audit results strong enough to carry the paper? **Novelty re-check #1.** Consider an arXiv preprint of the audit |
| 4 | Baselines complete under all protocols; evaluability matrix final; Ch. 4 draft |
| 5 | Tabular-DL baseline; taxonomy validation |
| 6 | Imbalance study (RQ3) |
| 7 | Scale study (RQ4). **Gate 2:** still novel? **Novelty re-check #2** |
| 8 | Hierarchy experiment (time-boxed); **paper draft and submission (by Month 9)** |
| 9 | Ch. 5-7 drafts; paper revisions |
| 10 | Ch. 1, 8; thesis revision |
| 11 | Extra experiments requested by supervisor/reviewers; polish |
| 12 | Submission and defence preparation (buffer) |
Monthly arXiv/Scholar/Crossref alerts: "BigFlow-NIDS", "NF-v3", "NetFlow cross-dataset", "NetFlow leakage".
---
## 9. Risks and mitigations
| Risk | Mitigation |
|---|---|
| **Scooped** by a 2026 NF-v3 cross-source or long-tail paper | Narrow to BigFlow-specific confounding and evaluability; early preprint; monthly alerts; re-check at Months 3, 7 and before submission |
| LOSO covers very few classes | Reported as a *finding* (evaluability matrix); family-level and binary LOSO add coverage |
| Per-class chronological split still shares attacker IPs | Add P3 (IP-group split) wherever feasible; report which classes are not group-evaluable |
| Attacks bound to 1-3 days make time splits weak | Embargoed per-class chronology; say plainly that this tests within-episode generalisation only |
| Source attribution rule (capture date) imperfect | Validated by IP plans (step 03); sensitivity check on boundary dates |
| Taxonomy v0 questioned | Provisional label, ATT&CK grounding, empirical comparison, sensitivity analysis |
| Rare-class metrics unstable | Repeated CV, CIs, minimum-support rule; report instability |
| Hierarchy does not help | Report as secondary negative result |
| Cluster access delayed | Develop on stratified samples; the learning curve justifies this |
| Journal not Scopus/WoS-indexed | Verify in Month 1 and Month 7 |
---
## 10. Verification plan
1. Parquet row count = 66,935,021; label counts match Table 2 (done, step 02).
2. Source rule validated by independent IP plans (done, step 03); boundary-date sensitivity check.
3. Evaluability matrix generated by code, not by hand; thresholds stated.
4. Duplicate counts and cross-source overlap reported (step 05); test rows with train-identical features excluded from scores.
5. Split files frozen with seeds; every protocol reports class coverage and train/test counts; no test row appears in train (asserted in code).
6. Every model score printed beside the source-only and majority baselines.
7. Rare-class results carry CIs and support counts; paired tests for method comparisons.
8. Learning curve and runtime table with cluster specification.
9. Novelty re-check recorded (date, queries, databases) at each gate.
---
## 11. Key references (verified entries are in `References/INDEX.csv`; the rest still to verify)
- Uddin et al., *Data in Brief* 65, 2026, doi:10.1016/j.dib.2026.112530 (BigFlow-NIDS; data doi:10.17632/nv729tbdgz.2)
- Luay et al., temporal analysis of NetFlow datasets, arXiv:2503.04404; "Time Matters" (IEEE Access 2026)
- Sarhan et al., *Mobile Networks and Applications* 2022; NetFlow datasets for ML-NIDS
- Apruzzese et al., "The Cross-Evaluation of ML-Based NIDS", *IEEE TNSM* 19(4), 2022
- Layeghy et al., "Benchmarking the benchmark", *JISA* 2024; Flood & Aspinall, EuroS&PW 2024
- Engelen et al. (CICIDS2017); Lanvin et al. (error prevalence); Arp et al. (Dos and Don'ts)
- Wolf et al. (resampling on NF-v1); Dinh et al.; Uddin et al. 2025 (hierarchical vs flat, *Ad Hoc Networks*)
- Imbalance: Chawla (SMOTE), Han (Borderline-SMOTE), He (ADASYN), Douzas (KMeans-SMOTE), Lin (focal), Cui (class-balanced), Menon (logit adjustment)
- Tabular: Arik & Pfister (TabNet), Gorishniy et al. (FT-Transformer), Grinsztajn et al.
- Big data: Huynh et al. (BigSIDS), Abushwereb et al. (Spark on BoT-IoT)
- Metrics/stats: Kiritchenko et al. (hierarchical F1), Demsar, Chicco & Jurman (MCC)
---
## Changes from v3
| Area | v3 | v4 |
|---|---|---|
| Positioning | Benchmark with a 31-class LOSO | Confounding audit + evaluability matrix + valid protocols; 31-class LOSO dropped as impossible |
| RQ1 | Merge audit planned | Partly answered (27/32 single-source; source-only accuracy 79.8% / 66.6%; IP fingerprints) |
| RQ2 | Coverage-aware LOSO + source-wide time split | Six defined protocols P1-P5 incl. P4b; source-wide time split dropped (8 classes lose their train window) |
| C2 | "31-class benchmark with LOSO and time splits" | Evaluability matrix and valid protocols |
| Feature sets | A/B/C named | A = 53, B = 47, C defined by a data-driven rule (step 06) |
| Pipeline | Phases only | Numbered steps 01-12 with status; 01-04 done |
| Taxonomy | Phase 4 plan | Taxonomy v0 in step 07 (provisional) enabling family-level LOSO |
| Paper title | "...Leakage-Safe, Multi-Source Benchmark of 31-Class..." | "What Does a 66-Million-Flow Merge Hide? ..." (confounding and protocols) |