-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minimal version of the LTE downgrade analyzer
This also renames the lte_parser crate to telcom_parser, since it'll handle any 2G or 3G parsing going forward.
- Loading branch information
1 parent
c5b455e
commit e99395c
Showing
19 changed files
with
150 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,6 @@ members = [ | |
"bin", | ||
"serial", | ||
"rootshell", | ||
"lte-parser", | ||
"telcom-parser", | ||
] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
use std::borrow::Cow; | ||
|
||
use super::analyzer::{Analyzer, Event, EventType, Severity}; | ||
use super::information_element::{InformationElement, LteInformationElement}; | ||
use telcom_parser::lte_rrc::{BCCH_DL_SCH_MessageType, BCCH_DL_SCH_MessageType_c1, CellReselectionPriority, SystemInformationBlockType7, SystemInformationCriticalExtensions, SystemInformation_r8_IEsSib_TypeAndInfo, SystemInformation_r8_IEsSib_TypeAndInfo_Entry}; | ||
|
||
/// Based on heuristic T7 from Shinjo Park's "Why We Cannot Win". | ||
pub struct LteSib7DowngradeAnalyzer { | ||
} | ||
|
||
impl LteSib7DowngradeAnalyzer { | ||
fn unpack_system_information<'a>(&self, ie: &'a InformationElement) -> Option<&'a SystemInformation_r8_IEsSib_TypeAndInfo> { | ||
if let InformationElement::LTE(message) = ie { | ||
if let LteInformationElement::BcchDlSch(bcch_dl_sch_message) = message { | ||
if let BCCH_DL_SCH_MessageType::C1(BCCH_DL_SCH_MessageType_c1::SystemInformation(system_information)) = &bcch_dl_sch_message.message { | ||
if let SystemInformationCriticalExtensions::SystemInformation_r8(sib) = &system_information.critical_extensions { | ||
return Some(&sib.sib_type_and_info); | ||
} | ||
} | ||
} | ||
} | ||
None | ||
} | ||
} | ||
|
||
// TODO: keep track of SIB state to compare LTE reselection blocks w/ 2g/3g ones | ||
impl Analyzer for LteSib7DowngradeAnalyzer { | ||
fn get_name(&self) -> Cow<str> { | ||
Cow::from("LTE SIB 7 Downgrade") | ||
} | ||
|
||
fn get_description(&self) -> Cow<str> { | ||
Cow::from("Tests for LTE cells broadcasting a SIB type 7 which include 2G/3G frequencies with higher priorities.") | ||
} | ||
|
||
fn analyze_information_element(&mut self, ie: &InformationElement) -> Option<super::analyzer::Event> { | ||
let sibs = &self.unpack_system_information(ie)?.0; | ||
for sib in sibs { | ||
match sib { | ||
SystemInformation_r8_IEsSib_TypeAndInfo_Entry::Sib6(sib6) => { | ||
if let Some(carrier_info_list) = sib6.carrier_freq_list_utra_fdd.as_ref() { | ||
for carrier_info in &carrier_info_list.0 { | ||
if let Some(CellReselectionPriority(p)) = carrier_info.cell_reselection_priority { | ||
if p == 0 { | ||
return Some(Event { | ||
event_type: EventType::QualitativeWarning(Severity::High), | ||
message: "LTE cell advertised a 3G cell for priority 0 reselection".to_string(), | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
if let Some(carrier_info_list) = sib6.carrier_freq_list_utra_tdd.as_ref() { | ||
for carrier_info in &carrier_info_list.0 { | ||
if let Some(CellReselectionPriority(p)) = carrier_info.cell_reselection_priority { | ||
if p == 0 { | ||
return Some(Event { | ||
event_type: EventType::QualitativeWarning(Severity::High), | ||
message: "LTE cell advertised a 3G cell for priority 0 reselection".to_string(), | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
SystemInformation_r8_IEsSib_TypeAndInfo_Entry::Sib7(SystemInformationBlockType7 { carrier_freqs_info_list: Some(carrier_info_list), .. }) => { | ||
for carrier_info in &carrier_info_list.0 { | ||
if let Some(CellReselectionPriority(p)) = carrier_info.common_info.cell_reselection_priority { | ||
if p == 0 { | ||
return Some(Event { | ||
event_type: EventType::QualitativeWarning(Severity::High), | ||
message: "LTE cell advertised a 2G cell for priority 0 reselection".to_string(), | ||
}); | ||
} | ||
} | ||
} | ||
}, | ||
_ => {}, | ||
} | ||
} | ||
None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
pub mod analyzer; | ||
pub mod information_element; | ||
pub mod lte_downgrade; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ pub mod log_codes; | |
pub mod gsmtap; | ||
pub mod gsmtap_parser; | ||
pub mod pcap; | ||
pub mod lte_rrc; | ||
pub mod analysis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "lte-parser" | ||
name = "telcom-parser" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.