Skip to content

Wrong FCS checkum in Dot11FCS #2579

@ash09

Description

@ash09

Brief description

Checksum is not calculated properly in Dot11FCS. The payload given to compute_fcs() contains the 4-bytes FCS field initialized with zeros.

Environment

  • Scapy version: v2.4.3
  • Python version: 3.5
  • Operating System: Debian 9

How to reproduce

In [19]: pkt = RadioTap() / Dot11FCS() / Dot11Beacon()                                                                  

In [20]: pkt.show()                                                                                                     
###[ RadioTap dummy ]### 
  version   = 0
  pad       = 0
  len       = None
  present   = Flags
  Flags     = FCS
  notdecoded= ''
###[ 802.11-FCS ]### 
     subtype   = 8
     type      = Management
     proto     = 0
     FCfield   = 
     ID        = 0
     addr1     = 00:00:00:00:00:00
     addr2     = 00:00:00:00:00:00
     addr3     = 00:00:00:00:00:00
     SC        = 0
     fcs       = None
###[ 802.11 Beacon ]### 
        timestamp = 0
        beacon_interval= 100
        cap       = 


In [21]: wireshark(Raw(pkt), linktype=DLT_IEEE802_11_RADIO)

Actual result

capture

Fix

scapy/layers/dot11.py

     def post_build(self, p, pay):
         p += pay
         if self.fcs is None:
-            p = p[:-4] + self.compute_fcs(p)
+            p = p[:-4] + self.compute_fcs(p[:-4])
         return p

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions