Manuscript Offprint

arXiv:2608.22812

The Surprising Effectiveness of LLMs in BGP Security: Mining An Unprecedented Amount of Incidents and Boosting Anomaly Detection

Libin Liu, Wenzhou Yang, Li Chen, Dan Li, Xiuting Xu

Libin Liu§, Wenzhou Yang†, Li Chen§, Dan Li‡, Xiuting Xu§

§Zhongguancun Laboratory, †Beijing University of Posts and Telecommunications, ‡Tsinghua University

Abstract—Border Gateway Protocol (BGP) security is critical to Internet infrastructure, yet progress in routing anomaly detection has been limited by the scarcity of publicly available incident datasets, which contain only 18 recorded cases. We observe that public operator mailing lists, e.g., NANOG and AusNOG, contain abundant yet largely untapped reports of real-world routing anomalies. To leverage this source, we develop an LLM-assisted extraction pipeline that identifies 244 candidate incidents from historical discussion threads. After expert validation, we curate a verified benchmark containing 232 confirmed routing anomaly events, making it 11.89×11.89\times larger than existing dataset.

Using this benchmark, we show that existing routing anomaly detection systems generalize poorly to diverse real-world incidents. At the same time, we find that some general-purpose LLMs without routing-specific adaptation can identify a subset of routing anomalies, but their performance varies across models and remains insufficient for reliable routing anomaly detection. Motivated by this observation, we design ROUTELLM, an LLM-based routing anomaly detector that integrates BGP-semantic-aware tokenization, routing-domain adaptation, and time-aware routing evidence retrieval. Experimental results show that ROUTELLM achieves 87.13% event-level accuracy and 94.65% message-level accuracy, outperforming the strongest baselines by 55.30% and 68.50%, respectively. We open-source the verified routing anomaly benchmark, fine-tuned model, and implementation code to support future research on BGP security 1^{1}.

Index Terms—BGP Security, Routing Anomaly Incidents, Routing Anomaly Detection, Large Language Model

I. INTRODUCTION

Securing inter-domain routing remains a critical challenge for the global Internet. Despite decades of research and the proposal of numerous security enhancements, such as BG-Psec [1], BGPiSec [2], psBGP [3], and S-BGP [4], deployment remains limited due to architectural incompatibilities and operational overhead. Meanwhile, the adoption of light-weight mechanisms such as ROA [5] and ASPA [6] is ongoing, but their effectiveness is constrained by partial deployment and the lack of Route Origin Validation (ROV) [7]. As a result, detecting anomalous BGP behavior remains an indispensable complementary defense [8]–[10].

A fundamental obstacle to advancing BGP anomaly detection is the lack of large-scale, real-world routing anomaly incident datasets. Existing systems are all evaluated using a very small number of incidents, at most 18 anomalies over the past two decades ( §\SII-A), or rely on simulated attacks. This data sparsity restricts the generalizability and robustness of detection systems, especially as routing anomalies evolve in sophistication and scale [11], [12].

We observe that public network operator mailing lists, such as NANOG [13], AfNOG [14], and RIPE NOGs [15], contain rich untapped information on real-world routing anomalies ( §\SII-C). Operators frequently report incidents, share logs, and coordinate mitigations via these channels. These reports often include sufficient detail, such as AS numbers, affected prefixes, and routing behaviors, to label ground-truth events. However, mining these sources is nontrivial: the text is unstructured, jargon-heavy, and mixed with unrelated operational discussions. For instance, NANOG alone contains over 286,292 emails authored by more than 9,500 individuals.

Recent advances in large language models (LLMs) [16]–[19] provide a potential solution. LLMs excel at processing unstructured text and extracting structured knowledge. We investigate whether LLMs can be used to automatically extract routing anomaly events from operator mailing lists. We prompt LLMs to parse entire email threads, identify anomaly reports, and extract structured incident data. We apply this approach to thirteen mailing lists covering more than three decades of discussions, yielding 244 candidate incidents ( §\SIII-B). To ensure reliability, we cross-validate results across multiple LLMs (GPT-5 [20], Gemini-3-Pro [21], and Claude-4.5-Haiku [22]) and verify final outputs with human experts. In the end, we obtain a curated dataset of 232 distinct anomaly events ( §\SIII-C), which is 11.89×11.89\times larger than the existing one.

We then revisit state-of-the-art (SOTA) routing anomaly detection systems using this expanded dataset. We evaluate BEAM [8] on the newly collected events and find that its detection accuracy degrades significantly: BEAM achieves only 57.67% event-level accuracy ( §\SIV-A). This gap suggests that existing systems may be overfitted to a narrow set of previously known anomalies ( §\SIV-C).

Motivated by the success of LLMs in related networking and security tasks [23]–[27], we ask a natural question: Can LLMs improve routing anomaly detection? To answer this, we evaluate general-purpose LLMs on the same detection task, without any domain-specific adaptation. Models like Llama-3.1-8B-Instruct achieve 54.24% accuracy on event-level anomaly detection, only 5.95% below BEAM [8], the state-of-the-art system ( §\SIV-B). However, the performance varies across models and remains insufficient for reliable routing anomaly detection.

Through manual inspection of representative false positives and false negatives, we find that LLMs often treat BGP updates as ordinary text, fail to capture protocol-level routing

1^{1}https://github.com/vvcode1/RouteLLM

© 2026 IEEE. Personal use of this material is permitted.

semantics, and make predictions without grounding on time-consistent routing evidence such as prefix ownership and AS relationships. These observations lead to three key insights for improving LLM-based routing anomaly detection: (1) LLMs should understand the structured semantics of BGP protocol data rather than flattening routing fields into plain text; (2) LLMs should acquire routing-domain knowledge, such as AS relationships and routing anomaly patterns; and (3) routing decisions should be grounded on time-consistent external routing evidence because Internet routing information continuously evolves ( §IV−C§IV-C).

Guided by these insights, we develop ROUTELLM, a routing-domain-adapted LLM framework for routing anomaly detection. ROUTELLM improves the routing anomaly detection capability of LLMs through three key designs. First, to enable LLMs to better understand structured BGP protocol data, ROUTELLM introduces a BGP-semantic-aware tokenizer that treats routing constructs, such as AS paths and announcements, as atomic semantic units ( §\SV-A). Second, to inject routing-domain knowledge into the model, ROUTELLM performs dual-stage fine-tuning on AS relationship data and labeled BGP anomaly datasets using parameter-efficient LoRA adaptation [28] ( §\SV-B). Although incident-level labels are limited, each incident contains many associated BGP updates and routing-evidence records, which are sufficient for adapting pretrained LLMs to routing anomaly detection [19], [27]. Third, to account for the dynamic nature of Internet routing, ROUTELLM incorporates a time-aware retrieval-augmented generation (RAG) pipeline that provides timestamp-consistent routing evidence, including AS relationships and prefix attribution information ( §\SV-C).

In this work, we adopt Llama-3.1-8B-Instruct as the base model and apply the ROUTELLM design pipeline to fine-tune it for routing anomaly detection. We choose this model because it provides a strong balance between reasoning capability, deployment cost, and fine-tuning efficiency for routing-domain adaptation ( §\SIV-B). Importantly, the ROUTELLM pipeline is model-agnostic and can be extended to other LLMs to further improve their routing anomaly detection capability.

In summary, we make the following contributions.

• We highlight the scarcity of existing routing anomaly incidents and demonstrate that operator mailing lists can be mined to extract high-quality anomaly incidents ( §\SII).

• We develop an automatic routing anomaly incident collection pipeline with LLMs. With specially designed prompts and expert curation, we collect 11.89×11.89 \times more incidents than prior work ( §\SIII).

• We use the collected routing incident dataset to evaluate a representative detector and vanilla LLMs, revealing a generalization gap in existing systems and the limitations of general-purpose LLMs without routing-domain adaptation ( §\SIV).

• We design and implement ROUTELLM, the first LLM-based routing anomaly detector. It bridges the gap between BGP data and LLMs, integrates routing knowledge through fine-tuning, and incorporates time-consistent external routing evidence through a dedicated retrieval pipeline ( §\SV, §\SVI).

• We evaluate ROUTELLM through testbed experiments. ROUTELLM achieves 87.13% average event-level accuracy and 94.65% average message-level accuracy, outperforming the compared schemes by at least 55.30% and 68.50%, respectively ( §\SVII).

References (92)

  • BGPsec Protocol Specification
  • BGP-iSec: Improved Security of Internet Routing against Post-ROV Attacks
  • On Inter-domain Routing Security and Pretty Secure BGP (psBGP)
  • Secure Border Gateway Protocol (S-BGP)
  • BGP Prefix Origin Validation
  • BGP AS_PATH Verification Based on Autonomous System Provider Authorization (ASPA) Objects
  • RPKI Is Coming of Age: A Longitudinal Study of RPKI Deployment and Invalid Route Origins
  • Learning with Semantics: Towards a Semantics-Aware Routing Anomaly Detection System
  • BGPmon Route Monitoring
  • Routing Information from Cloudflare Radar
  • Why Is It Taking so Long to Secure Internet Routing?
  • Mind Your Blocks: On the Stealthiness of Malicious BGP Hijacks
  • NANOG Mailing List
  • AfNOG Mailing List
  • The Design of an LLM-powered Unstructured Analytics System
  • Sentiment Analysis in the Era of Large Language Models: A Reality Check
  • DocETL: Agentic Query Rewriting and Evaluation for Complex Document Processing (opens arXiv in a new tab)
  • NetLLM: Adapting Large Language Models for Networking
  • Gemini-3-Pro
  • Claude-4.5-Haiku
  • Towards Explainable Network Intrusion Detection Using Large Language Models (opens arXiv in a new tab)
  • Large Language Model Guided Protocol Fuzzing
  • Large Language Models for Code Analysis: Do LLMs Really Do Their Job?
  • Large Language Models for Code: Security Hardening and Adversarial Testing
  • net-Found: Foundation Model for Network Security (opens arXiv in a new tab)
  • LoRA: Low-Rank Adaptation of Large Language Models
  • A Light-Weight Distributed Scheme for Detecting IP Prefix Hijacks in Real-Time
  • Accurate Real-Time Identification of IP Prefix Hijacking
  • iSPY: Detecting IP Prefix Hijacking on My Own
  • Buddyguard: A Buddy System for Fast and Reliable Detection of IP Prefix Anomalies
  • MS-LSTM: A Multi-Scale LSTM Model for BGP Anomaly Detection
  • ARTEMIS: Neutralizing BGP Hijacking within a Minute
  • Profiling BGP Serial Hijackers: Capturing Persistent Misbehavior in the Global Routing Table
  • Comparing Machine Learning Algorithms for BGP Anomaly Detection Using Graph Features
  • ISP Self-operated BGP Anomaly Detection based on Weakly Supervised Learning
  • A System to Detect Forged-Origin BGP Hijacks
  • Ares: Comprehensive Path Hijacking Detection via Routing Tree
  • HEAP: Reliable Assessment of BGP Hijacking Attacks
  • Detecting Prefix Hijackings in the Internet with Argus
  • An Internet Routing Forensics Framework for Discovering Rules of Abnormal BGP Events
  • BGP Hijacking Classification
  • Detecting BGP Instability Using Recurrence Quantification Analysis (RQA)
  • Machine Learning Models for Classification of BGP Anomalies
  • Separating Wheat from Chaff: Winnowing Unintended Prefixes Using Machine Learning
  • A Deep Learning Approach for IP Hijack Detection based on ASN Embedding
  • Suitability of Graph Representation for BGP Anomaly Detection
  • AP2Vec: An Unsupervised Approach for BGP Hijacking Detection
  • Detecting BGP Route Anomalies with Deep Learning
  • Cloudflare Radar’s new BGP origin hijack detection system
  • Cloudflare Radar’s New Route Leak Detection Service
  • A BGP Hijacking Event Report from NANOG Mailing List
  • Revisiting Recommended BGP Route Flap Damping Configurations
  • SAFNOG Mailing List
  • AusNOG Mailing List
  • INNOG Mailing List
  • PacNOG Mailing List
  • LACNOG Mailing List
  • ITNOG Mailing List
  • SGNOG Mailing List
  • NZNOG Mailing List
  • CaribNOG Mailing List
  • Internet Routing Registry (IRR)
  • Resource Public Key Infrastructure (RPKI)
  • Inferred AS Relationships Dataset
  • Implementation Codes of BEAM
  • TrafficFormer: An Efficient Pre-trained Model for Traffic Data
  • PentestGPT: Evaluating and Harnessing Large Language Models for Automated Penetration Testing
  • Large Language Models for Cyber Security: A Systematic Literature Review (opens arXiv in a new tab)
  • DeepSeek-R1-Distill-Qwen-7B
  • Llama-3.1-8B-Instruct
  • DeepSeek-V3
  • DeepSeek-R1
  • SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing
  • Byte Pair Encoding is Suboptimal for Language Model Pretraining (opens arXiv in a new tab)
  • In-Context Retrieval-Augmented Language Models
  • Graph-BGP: BGP Anomaly Detection based on Dynamic Graph Learning
  • BGPmon: A Real-Time, Scalable, Extensible Monitoring System
  • An Online Mechanism for BGP Instability Detection and Analysis
  • A Novel Unsupervised Method for Securing BGP against Routing Hijacks
  • Enhancing Network Management Using Code Generated by Large Language Models
  • Netconfeval: Can LLMs Facilitate Network Configuration?
  • Intent-Driven Network Management with Multi-Agent LLMs: The Confucius Framework
  • Extremal Testing for Network Software using LLMs (opens arXiv in a new tab)
  • Deploying Stateful Network Functions Efficiently Using Large Language Models
  • Understanding Misunderstandings: Evaluating LLMs on Networking Questions
  • A Route Leak Event Report from NANOG Mailing List
  • University of Oregon RouteViews Project
  • Routing Information Service (RIS)
  • bgpdump tool
  • Instruction-tuned Language Models are Better Knowledge Learners
  • The Faiss Library (opens arXiv in a new tab)
  • NIST/SEMATECH e-Handbook of Statistical Methods: Critical Values of the Student’s t Distribution