1 / 25

Hash-AV : Fast Virus Signature Scanning by Cache-Resident Filters

Hash-AV : Fast Virus Signature Scanning by Cache-Resident Filters. Author : Ozgun Erdogan and Pei Cao Publisher : IEEE Globecom 2005 (IJSN 2007) Presenter : Zong-Lin Sie Date : 2010/12/08. Introduction.

morse
Download Presentation

Hash-AV : Fast Virus Signature Scanning by Cache-Resident Filters

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hash-AV:Fast Virus Signature Scanning by Cache-Resident Filters Author: Ozgun Erdogan and Pei Cao Publisher: IEEE Globecom 2005 (IJSN 2007) Presenter: Zong-Lin Sie Date: 2010/12/08

  2. Introduction • This paper proposes Hash-AV, a virus scanning “booster” technique that aims to take advantage of improvements in CPU performance. • Using a set of hash functions and a bloom filter array that fits in CPU second-level (L2) caches, Hash-AV determines the majority of “no-match” cases without accesses to main memory.

  3. Introduction • Using bloom filters to speed up signature matching is not a new idea [3], [19]. • The key difference between those hardware solutions and our software solution is that the CPU computation cost of hash functions is not a concern in the former, but a key concern in the latter. • If the hash functions are not chosen well, computing the hashes can easily take enough CPU cycles to obliterate the advantage of cache-resident filters.

  4. Background (ClamAV) • The most widely used opensource anti-virus scanner • As of July 2005, it has a database of over 30,000 viruses. The database includes over 28,000 plain-text strings and over 1,300 strings with wild-card characters embedded. • The plain-text strings are for non-polymorphic viruses, and the strings with wild-card characters are for polymorphic viruses.

  5. Background (ClamAV) • The current version of Clam-AV uses an optimized version of the Boyer-Moore (BM) algorithm [2] for non-polymorphic signatures, and uses the Aho-Corasick (AC) algorithm [1] for polymorphic ones. • AC example: {he ,hers ,his ,she}

  6. Background (ClamAV) • Boyer Moore’s algorithm example: 1: EXAMPLE HERE IS A SIMPLE EXAMPLE 2: EXAMPLE HERE IS A SIMPLE EXAMPLE 3: EXAMPLE HERE IS A SIMPLE EXAMPLE 4: MPLEXAMPLE HERE IS A SIMPLE EXAMPLE

  7. Background (ClamAV) 5: EXAMPLE HERE IS A SIMPLE EXAMPLE 6: EXAMPLE HERE IS A SIMPLE EXAMPLE

  8. Hash-AV • It aims to determine the no-match cases with high accuracy, minimal main-memory access and a small number of CPU instructions. • It achieves the goals by using a filter that fits in CPU caches and acts as a first-pass scan to determine if the data need to go through an exact match algorithm.

  9. Hash-AV • Hash-AV constructs a bloom filter from the set of plaintext signatures. For each plain-text signature, k hash functions are applied to its first β bytes a, with results h1(a); h2(a); …; hk(a), all in the range of 1; …;N. The bits at positions h1(a); h2(a); …; hk(a) are then set to 1. • At scanning time, Hash-AV moves over the input data stream one byte at a time. For each β byte block b, the scanning algorithm applies the first hash function, h1(b), and checks the corresponding bit. If the bit is 1, it computes the next hash function h2(b); if not, it immediately goes over to the next byte

  10. Hash-AV • In the case where all k functions have positive bloom filter matches, Hash-AV needs to check for exact match. • Two alternatives: (1) Use Boyer-Moore. (2) Pre-construct a “secondary hash table” using the last hash function hk, with each entry holding a linked list of signatures which are checked linearly.

  11. Hash-AV • Based on our prior experience in using bloom filters [13], k = 4 works well. • Therefore, there are three choices left in setting up Hash-AV: (1) Choosing four hash functions; (2) Choosing the size of the bloom filter; (3) Choosing β;

  12. Hash-AV (Select hash function) • Performance measurements over a sample executable of 120 MB, and the percentage of false positives in the filter.β is 7 and the bloom filter size is 256 KB.

  13. Hash-AV (Select hash function) • We then tried two really fast “hash” functions: “mask” and “xor+shift”. • “Mask” takes the first four bytes, casts them to an integer, and chooses the lowest log2(N) bits, where N is the size of the bloom filter. • ex: 00000000 00000000 01010101 00110011 => 21811

  14. Hash-AV (Select hash function) • “Xor+shift” :Take first 6 bytes, cast byte 0-3 into an integer, and xor it with 0 to get first value. Xor 1-4 bytes with first value to get second value. Xor 2-5 bytes with second value to get final value. Then picks the lowest log2(N) bits. • “mask” and “xor+shift” can filter away 88% and 96% of the input bytes. However, used as first level hash functions, they can effectively cut down the number of times that the “good” hash functions are calculated by an order of magnitude. • Hash-AV contains the following four hash functions: mask, xor+shift, fast hash from hashlib.c [9] and sdbm [25].

  15. Hash function(sdbm [25]) •  hash(i) = hash(i - 1) * 65599 + str[i];

  16. Hash function(djb2 [26]) •   Daniel J. Bernstein hash(i) = hash(i - 1) * 33 + str[i];

  17. Hash-AV (select bloom filter size) • Pure Hashing Speed: (512KB L2 cache) Results peak at AMD’s second level cache size. If the filter does not fit in the cache, the cache miss latency dominates the throughput.

  18. Hash-AV (select bloom filter size) • The speed of Hash-AV on the Athlon 64 3200+ desktop over the sample 120MB executable file. • The best filter size is mostly determined by the CPU L2 cache size.

  19. Hash-AV (select β) • The choice of β is mainly affected by the distribution of signature lengths in the signature database. • Generally, larger βs are preferred. But (1) hash functions take more time to compute the result. Slows the algorithm down. (2) Hash-AV has to leave out short signatures. • The “xor+shift” function is designed to operate on six bytes of data, a lower limit of six is set on β.

  20. Hash-AV (select β) • Weighting these effects of , we decided to choose β = 7 in our algorithms.

  21. Performance • We compare the throughput of Hash-AV with that of Clam-AV, using both the 30,000 signature database and the 120K signature database. • The current implementation of Hash-AV focuses on improving the scanning speed for plain-text signatures. It uses the same Aho-Corasick (AC) implementation as Clam-AV. • Three different types of inputs are used: (1) the 120MB sample executable file as described (2) a file of 99 MB containing HTML data crawled from the web (3) a 100 MB random file.

  22. Performance

  23. Performance

  24. Performance

  25. Performance

More Related