[Paper Review] CATBERT: Context-Aware Tiny BERT for Detecting Social Engineering Emails
CATBERT is a context-aware, pruned BERT model that integrates email body text and header features to detect targeted social engineering emails with 87% detection rate at 1% false positive rate. By replacing half of the Transformer blocks with lightweight adapters and incorporating contextual metadata, it achieves superior accuracy, speed (160% faster than DistilBERT), and robustness against typos and synonym substitutions compared to LSTM, logistic regression, and DistilBERT baselines.
Targeted phishing emails are on the rise and facilitate the theft of billions of dollars from organizations a year. While malicious signals from attached files or malicious URLs in emails can be detected by conventional malware signatures or machine learning technologies, it is challenging to identify hand-crafted social engineering emails which don't contain any malicious code and don't share word choices with known attacks. To tackle this problem, we fine-tune a pre-trained BERT model by replacing the half of Transformer blocks with simple adapters to efficiently learn sophisticated representations of the syntax and semantics of the natural language. Our Context-Aware network also learns the context representations between email's content and context features from email headers. Our CatBERT(Context-Aware Tiny Bert) achieves a 87% detection rate as compared to DistilBERT, LSTM, and logistic regression baselines which achieve 83%, 79%, and 54% detection rates at false positive rates of 1%, respectively. Our model is also faster than competing transformer approaches and is resilient to adversarial attacks which deliberately replace keywords with typos or synonyms.
Motivation & Objective
- To address the challenge of detecting hand-crafted, targeted phishing emails that evade traditional signature and ML-based detection due to lack of shared keywords or malicious code.
- To improve detection performance by integrating contextual features from email headers with natural language representations from email bodies.
- To reduce model complexity and inference latency while maintaining high accuracy, enabling real-time deployment in security systems.
- To enhance robustness against adversarial evasion techniques such as typo substitutions and synonym replacements.
Proposed method
- Fine-tuned a pre-trained BERT model by replacing half of its Transformer blocks with lightweight adapters to reduce model size and computational cost.
- Integrated contextual features from email headers (e.g., sender-receiver relationships, domain info) with the BERT-based text representation to improve detection accuracy.
- Trained the model in two stages: pre-training on large-scale benign text followed by fine-tuning on a targeted phishing email dataset with both body and header features.
- Employed a hybrid architecture that combines BERT’s contextual attention with adapter modules to preserve performance while reducing parameters.
- Used LIME for local interpretability to validate model decisions and assess robustness to adversarial perturbations.
- Evaluated robustness using adversarial samples generated via synonym replacement and typo injection to test resilience under evasion attempts.
Experimental results
Research questions
- RQ1Can a fine-tuned, compressed BERT model effectively detect targeted phishing emails that lack shared keywords or malicious code with known attacks?
- RQ2How does incorporating email header context improve the detection performance of NLP-based phishing detectors compared to models using only email body text?
- RQ3To what extent does adapter-based compression reduce model size and inference time without sacrificing detection accuracy?
- RQ4How resilient is the model to adversarial attacks that substitute words with synonyms or introduce typos to evade detection?
- RQ5Can the model maintain high performance when faced with semantic perturbations such as word reordering or synonym replacement?
Key findings
- CATBERT achieved an 87% detection rate at a 1% false positive rate, significantly outperforming DistilBERT (83%), LSTM (79%), and logistic regression (54%) under the same conditions.
- The model is 15% smaller and 160% faster than DistilBERT, which is already 40% smaller than standard BERT, enabling efficient real-time deployment.
- CATBERT demonstrated strong robustness to adversarial attacks: it maintained high accuracy under both synonym replacement and typo injection, while baseline models saw significant performance degradation.
- LIME analysis confirmed that CATBERT correctly identifies suspicious tokens such as 'Payment' and 'P@yment', even when words are obfuscated with typos or Unicode characters.
- The integration of header context features improved detection performance over vanilla BERT, highlighting the value of metadata in phishing detection.
- The model successfully detected adversarially modified emails by identifying subword tokens like 'P' and 'yment' as suspicious, demonstrating resilience to Unicode obfuscation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.