Dynamically Weighted Hidden Markov Model for Spam Deobfuscation

Seunghak Lee, Iryoung Jeong, Seungjin ChoiIJCAI 2007

Abstract

Spam filters frequently encounter obfuscated text designed to bypass word-based recognition. While Lexicon Tree Hidden Markov Models (LT-HMMs) can effectively deobfuscate such text, their massive state space makes them computationally prohibitive for real-time applications. This paper introduces the Dynamically Weighted Hidden Markov Model (DW-HMM), a compressed architecture that groups states with identical emission probabilities into "super-states." By utilizing an auxiliary trie-based data structure to manage transitions dynamically, the DW-HMM reduces model size by several orders of magnitude while maintaining high accuracy and significantly improving processing speed.

Introduction

Spammers employ various obfuscation techniques—such as character substitution ("viagra" to "vi@gra"), insertion of symbols, or segmentation—to evade detection. Traditional deobfuscation methods utilize LT-HMMs, where each character in a dictionary corresponds to a state. However, a comprehensive dictionary can result in over 100,000 states, leading to high computational costs that are impractical for high-volume mail servers processing thousands of messages per second.

Methodology: The DW-HMM Framework

The core innovation of the DW-HMM is the decoupling of character identification from its lexical context. This is achieved through three primary components:

1. Super-states and Model Compression

In a character-based HMM, many states share identical emission probabilities (e.g., all instances of the letter 'a'). The DW-HMM collapses these into a single "super-state" for each character in the alphabet. This drastically reduces the state space from over 110,000 to just 55.

Comparison of standard HMM, DW-HMM, and the auxiliary trie structure Φ.

2. The $\Phi$ Data Structure and Dynamic Weighting

Because super-states lose the context of specific words, the authors introduce $\Phi$, a trie-based data structure that stores the original transition probabilities. During decoding, a dynamic weight function $\omega$ calculates transition probabilities on the fly by referencing the current path within $\Phi$. This allows the model to "re-inflate" lexical context only where necessary during the search process.

3. N-best Search Strategy

The ambiguity introduced by super-states (where one 'a' could belong to many words) can lead a standard Viterbi search to prune correct paths prematurely. The authors found that a 2-best search—maintaining the top two hypotheses at each step—effectively recovers the accuracy of the original uncompressed model.

The step-by-step decoding process showing observations, super-state transitions, and hypothesis tracking in Φ.

Experimental Results

The model was evaluated using an 83,552-word English dictionary and the 2005 TREC public spam corpus.

  • Compression and Speed: The DW-HMM reduced the state count from 110,919 to 55. This compression resulted in a speedup from 10 characters/second to 207 characters/second for standard Viterbi, and up to 2,038 characters/second when combined with a beam search (width 10).
  • Accuracy: The system achieved an overall deobfuscation accuracy of 96.9%. It performed exceptionally well on segmentation (94.2%) and substitutions (92.5%).

Discussion and Limitations

While the DW-HMM offers significant performance gains, it faces challenges with character deletions, where accuracy dropped to 26.3%. Additionally, the system's effectiveness is inherently tied to the quality and breadth of its underlying dictionary. Future work may involve expanding the dictionary to include evolving spam terminology and improving the model's robustness against deletions.

Summary updated

BibTeX
@inproceedings{lee2007dynamically,
  author = {Seunghak Lee and Iryoung Jeong and Seungjin Choi},
  title = {{Dynamically Weighted Hidden Markov Model for Spam Deobfuscation}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2007},
}
Figure