BGP security uses layered controls to reduce prefix hijacking, route leaks, unauthorized peer access, excessive advertisements and control-plane attacks.
Learning objectives
- Explain prefix hijacking and route leaks.
- Implement prefix filtering and maximum-prefix protection.
- Explain RPKI, ROA and ROV.
- Differentiate Valid, Invalid and NotFound.
- Understand TCP MD5, TCP-AO and GTSM.
- Apply control-plane protection and security QA.
1. Threat landscape
| Threat | Description |
|---|---|
| Prefix hijacking | An AS originates a prefix it is not authorized to originate. |
| Route leak | Routing information propagated beyond intended scope or contrary to policy. |
| Unauthorized peering | Unexpected system attempts a BGP session. |
| Session disruption | Attempt to interrupt BGP session. |
| Bogon advertisements | Invalid/reserved/unacceptable prefixes advertised. |
| Excessive advertisements | Peer sends unexpectedly large route count. |
| Control-plane attack | Traffic targets router control-plane resources. |
2. Hijacking versus route leak
| Feature | Prefix hijacking | Route leak |
|---|---|---|
| Main issue | Unauthorized prefix origin | Improper route propagation |
| Typical cause | Incorrect/malicious origination | Incorrect export policy |
| AS_PATH | May show unauthorized origin | May show otherwise legitimate origin |
| Protection | RPKI/ROV and prefix filters | Import/export policy and leak prevention |
A more-specific unauthorized prefix can attract traffic otherwise destined for a covering prefix, if accepted and installed.
3. Prefix filtering
ip prefix-list CUSTOMER-OUT seq 10 permit 203.0.113.0/24
ip prefix-list CUSTOMER-OUT seq 20 permit 198.51.100.0/24
router bgp 65001
neighbor 11.1.1.2 prefix-list CUSTOMER-OUT out
!
ip prefix-list ALLOW-PREFIXES seq 10 permit 203.0.113.0/24 le 28
Inbound filters control accepted routes; outbound filters control advertised routes. Entries are evaluated in order, with implicit deny when no entry matches.
4. Maximum-prefix
router bgp 65001
neighbor 11.1.1.2 maximum-prefix 1000
Warning thresholds and actions vary by platform. Test below, at and above threshold, then verify logs, session behaviour and recovery.
5. RPKI, ROA and ROV
A ROA authorizes an origin AS to originate a prefix and may specify maximum permitted prefix length. A validator retrieves and validates signed RPKI data; routing policy uses the resulting origin-validation state.
| ROV state | Meaning |
|---|---|
| Valid | Covering ROA exists; origin AS and prefix length authorized. |
| Invalid | Covering ROA exists, but origin AS mismatches or prefix length exceeds maxLength. |
| NotFound | No covering ROA exists. |
ROV is a validation signal, not an automatic reject. Routing policy determines whether Invalid routes are rejected, accepted with lower preference or otherwise handled.
6. TCP authentication and GTSM
router bgp 65001
neighbor 11.1.1.2 password BGP-SECURE-KEY
TCP MD5 is specified in RFC 2385 and commonly used for BGP peer authentication. TCP-AO (RFC 5925) is newer; support varies.
router bgp 65001
neighbor 11.1.1.2 ttl-security hops 1
GTSM (RFC 5082) uses TTL/Hop Limit checks to protect suitable sessions, especially directly connected peers. It does not replace authentication, prefix filtering or other controls.
7. Control-plane protection
- Restrict TCP/179 to authorized peer addresses.
- Protect management access and credentials.
- Apply inbound/outbound prefix filters.
- Set maximum-prefix limits based on expected route volumes.
- Use RPKI/ROV and define policy for each state.
- Use peer authentication and GTSM where appropriate.
- Apply control-plane policing or platform equivalent.
- Monitor route counts, session changes, logs and anomalies.
- Maintain secure backups, software updates and policy reviews.
8. EVE-NG security lab plan
- Prefix filtering: advertise permitted/prohibited routes and verify acceptance/export.
- Maximum-prefix: set a low lab threshold, exceed it and inspect logs/session action.
- Authentication: establish with matching keys, then test controlled mismatch.
- RPKI: if validator and router integration are available, test all three states.
- GTSM: configure compatible directly connected peers and verify TTL enforcement.
- Route-leak prevention: apply export policies and verify prohibited propagation.
Senior QA scenarios
| ID | Test | Expected result |
|---|---|---|
| O-01 | Authorized prefix | Accepted. |
| O-02 | Unauthorized prefix | Rejected by filter. |
| O-03 | More-specific beyond allowed length | Rejected. |
| O-04 | Outbound filtering | Only authorized routes advertised. |
| O-05 | Exceed maximum-prefix | Configured threshold action occurs. |
| O-06 | Matching TCP MD5 keys | Peer can establish subject to other checks. |
| O-07 | Mismatched keys | Authentication fails. |
| O-08 | RPKI Valid route | Validation reports Valid. |
| O-09 | RPKI Invalid route | Validation reports Invalid. |
| O-10 | No covering ROA | NotFound. |
| O-11 | Policy for Invalid route | Outcome matches policy. |
| O-12 | GTSM direct peer | Valid traffic meets TTL checks. |
| O-13 | Unauthorized TCP/179 | Access restricted. |
| O-14 | Prohibited export | Route not advertised. |
| O-15 | Excessive updates | Monitoring/protection behave as designed. |
| O-16 | Restart after policy correction | Session/routes recover. |
| O-17 | Route-leak prevention | Prohibited propagation blocked. |
| O-18 | Security event logging | Relevant events recorded. |
Interview questions
- What is prefix hijacking?
- What is a route leak?
- What is RPKI?
- What does a ROA specify?
- Explain Valid/Invalid/NotFound.
- Does RPKI automatically reject Invalid routes?
- How does maximum-prefix work?
- What is TCP MD5?
- What is TCP-AO?
- What is GTSM?
- Why use inbound and outbound filters?
- How test route-leak prevention?
- AS-path versus prefix filtering?
- How investigate suspected hijack?
- What is defence in depth?
Student Knowledge Assessment – Module O – Security (approved assessment)
Q1. Which RFC defines BGP-4?
A. RFC 1918
B. RFC 4271
C. RFC 2385
D. RFC 5082
Correct answer: B. RFC 4271
Explanation: RFC 4271 defines BGP-4.
Q2. What is prefix hijacking?
A. Unauthorized origination of a prefix
B. Normal aggregation
C. Timer negotiation
D. Route reflection
Correct answer: A. Unauthorized origination of a prefix
Explanation: An AS originates a prefix it is not authorized to originate.
Q3. What is a route leak?
A. TCP failure
B. Improper propagation of routing information
C. Missing ROA
D. Keepalive
Correct answer: B. Improper propagation of routing information
Explanation: Routes are propagated contrary to intended routing policy or scope.
Q4. What does a ROA specify?
A. BGP timers
B. Authorized prefix and origin AS, optionally maxLength
C. Interface speed
D. TCP port
Correct answer: B. Authorized prefix and origin AS, optionally maxLength
Explanation: A ROA authorizes an origin AS and may specify maximum prefix length.
Q5. A route matches covering ROA origin and permitted length. State?
A. Invalid
B. NotFound
C. Valid
D. Unknown
Correct answer: C. Valid
Explanation: Both origin and prefix length are authorized.
Q6. A covering ROA exists but origin AS is wrong. State?
A. Valid
B. Invalid
C. NotFound
D. Established
Correct answer: B. Invalid
Explanation: The origin AS does not match authorization.
Q7. No covering ROA exists. State?
A. Invalid
B. Valid
C. NotFound
D. Rejected
Correct answer: C. NotFound
Explanation: NotFound means no covering ROA is available.
Q8. Does Invalid automatically mean router rejects route?
A. Yes, always
B. No, routing policy decides
C. Only iBGP
D. Only MED zero
Correct answer: B. No, routing policy decides
Explanation: ROV supplies state; policy determines action.
Q9. Purpose of maximum-prefix?
A. Limit route count from neighbour
B. Increase TCP window
C. Set AS_PATH length
D. Change router ID
Correct answer: A. Limit route count from neighbour
Explanation: It protects against unexpectedly large received route counts.
Q10. Which RFC defines TCP MD5 for BGP peer authentication?
A. RFC 4271
B. RFC 2385
C. RFC 8092
D. RFC 4360
Correct answer: B. RFC 2385
Explanation: TCP MD5 is specified in RFC 2385.
Q11. Which RFC defines GTSM?
A. RFC 5082
B. RFC 1997
C. RFC 5925
D. RFC 8092
Correct answer: A. RFC 5082
Explanation: RFC 5082 specifies GTSM.
Q12. Which control determines prefixes advertised to a neighbour?
A. Inbound prefix filter
B. Outbound prefix filter
C. Hold timer
D. Route distinguisher
Correct answer: B. Outbound prefix filter
Explanation: Outbound filtering controls advertised routes.
Q13. Purpose of TCP-AO?
A. Route aggregation
B. TCP connection authentication
C. Route reflection
D. Prefix origination
Correct answer: B. TCP connection authentication
Explanation: TCP-AO provides TCP authentication and is defined in RFC 5925.
Q14. Which mechanism uses TTL checks?
A. RPKI
B. GTSM
C. ROA
D. LOCAL_PREF
Correct answer: B. GTSM
Explanation: GTSM checks packet TTL or Hop Limit.
Q15. Best BGP security approach?
A. Only RPKI
B. Only MD5
C. Multiple complementary controls
D. Disable all advertisements
Correct answer: C. Multiple complementary controls
Explanation: Defence in depth combines filtering, validation, authentication, limits, control-plane protection and monitoring.