FPGA-BASED ARCHITECTURE FOR PATTERN MATCHING USING CUCKOO
HASHING IN NETWORK INTRUSION DETECTION SYSTEM
TRAN NGOC THINH
A DISSERTATION SUBMITTED IN PARTIAL FULFILLMENT
OF THE REQUIREMENT FOR THE DEGREE OF
DOCTOR OF ENGINEERING IN ELECTRICAL ENGINEERING
FACULTY OF ENGINEERING
KING MONGKUT’S INSTITUTE OF TECHNOLOGY LADKRABANG
2009
KMITL 2009-EN-D-018-024
สถาปตยกรรมตัวตรวจสอบความเหมือนของรูปประโยค
โดยใชคกุ คูแฮชชิง่ สําหรับการโจมตีทางเครือขาย
ทัน
งอบทิน
TRAN NGOC THINH
วิทยานิพนธนเี้ ปนสวนหนึง่ ของการศึกษาตามหลักสูตรปริญญาวิศวกรรมศาสตรดุษฎีบณ
ั ทิต
สาขาวิชาวิศวกรรมไฟฟา
คณะวิศวกรรมศาตร
สถาบันเทคโนโลยีพระจอมเกลาเจาคุณทหารลาดกระบัง
พ.ศ. 2552
KMITL 2009-EN-D-018-024
COPYRIGHT 2009
FACULTY OF ENGINEERING
KING MONGKUT’S INSTITUTE OF TECHNOLOGY LADKRABANG
หัวขอวิทยานิพนธ
นักศึกษา
ระดับการศึกษา
สาขาวิชา
พ.ศ.
อาจารยที่ปรึกษาวิทยานิพนธ
สถาปตยกรรมตัวตรวจสอบความเหมือนของรูปประโยค
โดยใชคุกคูแฮชชิ่งสําหรับการโจมตีทางเครือขาย
ทัน งอบทิน รหัสประจําตัว
49060028
วิศวกรรมศาสตรดุษฎีบัณฑิต
วิศวกรรมไฟฟา
2552
ผศ.ดร. สุรินทร กิตติธรกุล
บทคัดยอ
ก า ร ต ร ว จ ส อ บ ค ว า ม เ ห มื อ น ข อ ง รู ป ป ร ะ โ ย ค
การโจมตีสําหรับประยุกตใชในการตรวจจับและปองกันการบุกรุกทางเครือขายจําเปนตองมีทรูพุท
สู ง อย า งยิ่ ง จึ ง ต อ งมี ก ารเพิ่ ม เติ ม รู ป ประโยค ของการโจมตี ใ หม ๆ
เป น ระยะๆ
ด ว ย คุ ณ ลั ก ษ ณ ะ แ บ บ ข น า น ห รื อ ไ พ พ ไ ล น ข อ ง ฮ า ร ด แ ว ร ร ะ บ บ ก า ร ต ร ว จ จั บ
ก า ร บุ ก รุ ก ที่ ใ ช ฮ า ร ด แ ว ร จึ ง มี ค ว า ม ส า ม า ร ถ เ ห นื อ ก ว า ร ะ บ บ ที่ เ ป น ซ อ ฟ ต แ ว ร
วิทยานิพนธฉบับนี้จึงนําเสนอระบบการตรวจสอบความเหมือนของรูปประโยคการโจมตีโดยใชฮาร
ด
แ
ว
ร
แ
บ
บ
รีคอนฟกกูเรเบิลจํานวนสองสถาปตยกรรม โดยขนิดแรกใชสถาปตยกรรมอาเรยของตัวประมวลผล
และชนิดที่สองใชอัลกอริธึมการแฮชชื่อ “คุกคู”
วิ ท ย า นิ พ น ธ นี้ นํ า เ ส น อ ก า ร วิ เ ค ร า ะ ห ก ฏ ก า ร บุ ก รุ ก ต า ง ๆ
ข อ ง ส น อ ร ท ใ น ก า ร ส ร า ง ตั ว ต ร ว จ ส อ บ ค ว า ม เ ห มื อ น ช นิ ด แ ร ก
ดวยสถาปตยกรรมอาเรยของตัวประมวลผลจํานวนมาก โดยสามารถทํางานดวยทรูพุทสูงสุดถึง
12.58
จิ ก ะ บิ ท ต อ วิ น า ที
และดวยวิธี การเขารหัสอยางยอเพื่อเปนการประหยัดพื้นที่หนวยความจําในการเก็บกฏตางๆ
โดยสามารถลดพื้นที่ลงไดถึง 50% เมื่อเปรียบเทียบกับการ เขารหัสแบบแอสกี้
สถาปตยกรรมที่สองใชอัลกอริธึมการแฮชชื่อ “คุกคู” โดยมีคุณลักษณะการเพิ่มเติมรูป
ประโยคการโจมตีในขณะที่ยังทํางานไปพรอมๆ กัน และตั้งชื่อวา “พาเมลา” โดยแบงขั้นตอนการ
พัฒนาออกเปนสามชวง คือ หนึ่ง การใชการแฮชแบบคุกคูและลิงคลิสตสรางตัวตรวจสอบความ
เหมือนของรูปประโยคการโจมตีที่ความยาวตางๆ สอง การเพิ่มหนวยความจําชนิดสแตกและไฟโฟ
เพื่อจํากัดเวลาการเพิ่มกฏ และสาม การขยายขีดความสามารถใหประมวลผลหลายๆ ตัวอักษร
พรอมกัน เพื่อใหไดทรูพุทสูงสุดถึง 8.8 จิกะบิทตอวินาที โดยใชปริมาณฮารดแวรอยางคุมคากวา
ระบบอื่นๆ ที่ใชเอฟพีจีเอของ Xilinx เชนกัน
I
Thesis Title
Student
Student ID
Degree
Program
Year
Thesis Advisor
FPGA-based Architecture for Pattern Matching using Cuckoo
Hashing in Network Intrusion Detection System
Mr. Tran Ngoc Thinh
49060028
Doctor of Engineering
Electrical Engineering
2009
Asst. Prof. Dr. Surin Kittitornkun
ABSTRACT
Pattern matching for network intrusion/prevention detection requires extremely high
throughput with frequent updates to support new attack patterns. With naturally
parallel/pipelined characteristic, current hardware implementations have outstanding
performance over software implementations. In this dissertation, we propose two
reconfigurable hardware engines using processor array architecture and a recently
proposed hashing algorithm called Cuckoo Hashing.
In the first proposed engine, the rule set of a Network Intrusion Detection System,
SNORT, is deeply analyzed. Compact encoding method is proposed to decrease the
memory space for storing the payload content patterns of entire rules. This method can
approximately decrease up to 50% of area cost when compared with traditional ASCII
coding method. After that, a reconfigurable hardware sub-system for Snort payload
matching using systolic design technique is implemented. The architecture is optimized
with sharing of substrings among similar patterns and compact encoding tables. As a
result, the system is a processor array architecture that can match patterns with the
highest throughput up to 12.58 Gbps and area efficient manner.
The second architecture features on-the-fly pattern updates without reconfiguration,
more efficient hardware utilization. The engine is named Pattern Matching Engine with
Limited-time updAte (PAMELA). First, we implement the parallel/pipelined exact pattern
matching with arbitrary length based on Cuckoo Hashing and linked-list technique.
II
Second, while PAMELA is being updated with new attack patterns, both stack and FIFO
are incorporated to bound insertion time due to the drawback of Cuckoo Hashing and to
avoid interruption of input data stream. Third, we extend the system for multi-character
processing to achieve higher throughput. Our engine can accommodate the latest Snort
rule-set and achieve the throughput up to 8.8 Gigabit per second while consuming the
lowest amount of hardware. Compared to other approaches, PAMELA is far more
efficient than any other implemented on Xilinx FPGA architectures.
III
Acknowledgements
First of all, I would like to deeply thank Assistant Professor Dr. Surin Kittitornkun of
King Mongkut’s Institute of Technology Ladkrabang, my Advisor, and Professor Dr.
Shigenori Tomiyama of Tokai University, Japan, my Co-Advisor, for their helpful
suggestions and constant supports during the research work of this dissertation at King
Mongkut’s Institute of Technology Ladkrabang and Tokai University.
I am also thankful to my dissertation committee members in the Department of
Computer Engineering, Faculty of Engineering, King Mongkut’s Institute of Technology
Ladkrabang, for their insightful comments and helpful discussions which give me a
better perspective of this dissertation.
I should also mention that my Ph.D study in King Mongkut’s Institute of Technology
Ladkrabang and Tokai University is entirely supported by the AUN-SeedNet Program of
JICA.
Finally, I would like to acknowledge the supports of all of my beloved family and
friends for all of their helps and encouragements.
Bangkok, Thailand
April, 2009
Tran Ngoc Thinh
IV
Contents
Page
บทคัดยอ ....................................................................................................................................................I
ABSTRACT...............................................................................................................................................II
Acknowledgements ................................................................................................................................IV
Contents ...................................................................................................................................................V
List of Tables..........................................................................................................................................VII
List of Figures........................................................................................................................................VIII
1 Introduction.....................................................................................................................................1
1.1
Motivation..............................................................................................................................1
1.2
Existing Approaches.............................................................................................................2
1.3
Statement of Problem............................................................................................................4
1.4
Contributions.........................................................................................................................5
1.5
Organization..........................................................................................................................7
2 Background and Related Approaches ..........................................................................................8
2.1
Network Intrusion Detection Systems (NIDS).......................................................................8
2.1.1 Snort NIDS........................................................................................................................ 9
2.1.2 Pattern Matching in Software NIDS Solutions................................................................ 11
2.1.3 Hardware-based Pattern Matching Architectures in NIDS ........................................... 14
2.1.3.1 CAMs & Shift-and-compare..................................................................................16
2.1.3.2 Nondeterministic/Deterministic Finite Automata ..................................................18
2.1.3.3 Hash Functions.....................................................................................................20
2.2
Cuckoo Hashing..................................................................................................................22
3 Processor Array-Based Architectures for Pattern Matching........................................................24
3.1
Processor Array-Based Architecture for pattern maching in NIDS....................................24
3.1.1 Compact encoding of pattern and text.......................................................................... 25
3.1.2 Match Processor Array .................................................................................................. 28
3.1.3 Area and Performance Improvement ............................................................................ 31
3.2
FPGA Implementation of Processor-based Architecture ...................................................34
4 Parallel Cuckoo Hashing Architecture .........................................................................................40
4.1
PAMELA: Pattern Matching Engine with Limited-time Update for NIDS/NIPS...................41
4.1.1 FPGA-Based Cuckoo Hashing Module ......................................................................... 42
4.1.1.1 Parallel Lookup: ....................................................................................................43
4.1.1.2 Dynamic Insertion and Deletion ...........................................................................45
V
4.1.1.3 Recommended Hash Function.............................................................................46
4.1.1.4 Hardware Optimization for Cuckoo Module.........................................................47
4.1.2 Matching Long Patterns................................................................................................. 48
4.1.3 Massively Parallel Processing........................................................................................ 52
4.2
Performance Analysis .........................................................................................................54
4.2.1 Theoretical Analysis ....................................................................................................... 54
4.2.1.1 Insertion time ........................................................................................................54
4.2.1.2 Limited-time Update .............................................................................................57
4.2.1.3 Latency and Speedup ..........................................................................................61
4.2.1.4 Hardware Utilization..............................................................................................63
4.2.2 Performance Simulations ............................................................................................... 65
4.2.2.1 Off-line Insertion of Short Patterns........................................................................65
4.2.2.2 Off-line Insertion of Long Patterns........................................................................68
4.2.2.3 Dynamic Update for New Patterns.......................................................................69
4.3
FPGA Implementation Results of PAMELA.........................................................................72
5 Conclusions and Future Works ....................................................................................................76
5.1
Conclusions.........................................................................................................................76
5.2
Future Works .......................................................................................................................76
Bibliography...........................................................................................................................................78
A Publication List .............................................................................................................................87
VI
List of Tables
Table
Page
Table 3.1 Comparison of Processor Array-based Architecture and previous FPGA-based pattern
matching architectures.................................................................................................................39
Table 4.1 Summary of main notations used in the performance analysis ............................................55
Table 4.2 Comparison of the number of insertions of various hash functions. index table size is 256.
The number of trials is 1000. CRC_hard, Tab_hard and SAX_hard are the FPGA-based systems
......................................................................................................................................................66
Table 4.3 Dynamic Update Comparison for A Pattern..........................................................................72
Table 4.4. Logic and Memory Cost of PAMELA in Xilinx Virtex-4 .........................................................73
Table 4.5. Performance Comparison of FPGA-based Systems for NIDS/NIPS....................................75
VII