WEP加密(Wired Equivalent Privacy )概念

Authentication

SystOpen em Authentication

Open system authentication does not provide authentication, only identification using the wireless adapter’s media access control (MAC) address. This authentication is used when no authentication is required. Open system authentication uses the following process (shown in Figure 1): 

1 The authentication-initiating wireless client sends an Open System Authentication Request message, which contains the MAC address as the source address of the 802.11 frame.

2 The receiving wireless node, typically a wireless access point (AP), responds with an Open System Authentication Response message that indicates either success (the authentication-initiating wireless client is authenticated) or failure. 

Some wireless APs allow you to configure a list of MAC addresses of wireless clients that are authorized. However, this does not protect a wireless network because an attacker can easily capture wireless packets of connected clients and then use the MAC address of a valid wireless client as its own.

 

 原则上接入点处于开放模式,它总会接收认证请求,然后发回认证成功的消息。这就是开放系统的定义。有时候会想开放系统为何这样定义,这样定义是否有意义?

  从认证的目的来说,认证的目的就是双方证明自己就是所宣称的那一个。在局域网环境中每台设备都有一台唯一的MAC地址。因此可以通过MAC地址来检查出发送者的身份。

那怎么知道不会有人用假的MAC地址伪造信息呢。解决办法就是,当设备第一次加入到网络时就认证设备,商定一个密码用于保护以后的每条消息。因为只有真的设备和接入点知道这个密码,这样每条消息收到时被确认为有效。

 但在WEP,在它的认证阶段,新设备要证明自己是可信任的成员是如何进行的?接入点的逻辑是,如果设备能证明自己可信,那么它就理所当然的相信设备 的MAC地址是真实的。基于这一信任,它将让该设备加入。(类似于检查一个人是否是合法的人,只要他有身份证就认为它是合法的)。但在WEP中签权时没有做任何标记,所以不能证实后续的消息究竟是来自于受任凭的设备还是来自于冒牌设备,所以WEP认证并不符合认证的目的,基本上是一个无意义的演习。所以虽然IEEE802.11标准中仍有此认证过程,但在WI-FI规范已完全被删除掉了。

Shared Key Authentication

Shared key authentication verifies that an authentication-initiating station has knowledge of a shared secret, sometimes known as a passcode. The IEEE 802.11 standard assumes that the shared secret is delivered to the participating wireless clients by means of a secure channel that is independent of IEEE 802.11. In practice, this secret is a sequence of characters typed during the configuration of the wireless AP and the wireless client.

Shared key authentication uses the following process (shown in Figure 2): 

1The authentication-initiating wireless client sends a Shared Key Authentication Request frame. 

2The authentication-enforcing wireless node responds with a Shared Key Authentication Response frame that contains challenge text. 

3The authentication-initiating wireless node responds with a Shared Key Authentication Request frame that contains an encrypted form of the challenge text, which is encrypted using Wired Equivalent Privacy (WEP) (the encryption method used on 802.11 wireless networks) and the shared key authentication key. 

4The authentication-enforcing wireless node decrypts the encrypted challenge text in the Shared Key Authentication Request frame using WEP and the shared key authentication key. If the decrypted challenge text matches the originally sent challenge text, the authentication-enforcing wireless node sends a Shared Key Authentication Response frame that indicates authentication success. Otherwise, the authentication-enforcing wireless node sends a Shared Key Authentication Response frame that indicates authentication failure.

Because the shared key authentication secret must be manually distributed and typed, this method of authentication does not scale to large infrastructure mode networks (for example, corporate campuses and public places). 

Another serious problem with shared key authentication is that for configuration simplicity, the shared key authentication key is the same as the WEP encryption key used to encrypt all data between the authentication-initiating wireless client and the authentication-enforcing wireless node. The shared key authentication exchange includes a plaintext (the challenge text) and ciphertext (the encrypted challenge text) exchange with an indication of success. An attacker can capture a successful shared key authentication exchange and determine the shared key authentication key, which is also the WEP encryption key, through cryptanalysis methods. After determining the WEP encryption key, the attacker has full access to the wireless network and can begin attacking wireless nodes. Therefore, the use of shared key authentication is highly discouraged, even for small office/home office (SOHO) wireless networks. 

共享认证又叫WEP认证,移动设备要接入网络时,必须要知道密码才允许接入。

当移动设备请求认证时,接入点发出一个随机数(质询文本),移动设备用密码把这个质询文本加密后发回给接入点。因为接入点事先存储了质询文本和密钥,它就可以检查移动接入点发回的数据是否是用正确的密钥加密的。就可以实现认证。

  但此时如果有人在监听,那么监听者就可以获得一些有用的信息,如质询时含有明文,而应答里含有密文。

 共享认证的好处是:除非知道密钥,否则它将禁止工作站接入网络。这样能够尽早拒绝连接后无法通信的移动设备。

 开放认证:不论移动设备是否知道密钥,接入点都允许其接入,但他发送的每条信息都会因为解密失败被接入点丢弃。

  目前多数WI-FI系统里采用的是开放认证,接入后使用加密。有效地跳过了共享认证阶段给监听者带去有效信息的阶段。虽然他不受质询也能进入网络,但不有加密的密钥,他不能收发任何数据。

Encryption 

流密钥相关背景

WEP 用以保护数据的RC4密码(chiper),属于对称性流密码(stream chiper)。一般来说,流密码会用到密钥流(key stream)的位流,密钥流会有信息结合产生密文。为了还原信息,接收端会以相同的密钥流来处理密文。RC4利用异或来实现。

流密码的运作方式是通常是选用一把较短的密钥,然后将其展开为与信息等长的伪随机数密钥流。伪随机数生成器(pseudorandom  number generator )是一组将密钥展开为密钥流的规则。为了还原数据,双方必须使用相同的密钥并且使用相同的密钥算法将密钥展开为伪随机数序列。

流密钥的安全性,完全取决于密钥流(key stream)的随机程度。

 RC4的基本思想就是生成一个叫密钥流的伪随机序列字节流,然后和数据相异或产生密文。

为什么叫做伪随机密钥流,连接两端只要知道密钥就可以生成相同的伪随机密钥流序列。

 异或操作的原理,就是比较字节中相应的位,如果相等则为0,如果不等,结果就是1

例如:

异或的另一个种要性质就是

A异或BC,则C异或BA成立

WEP 中就是利用这个性质:

加密:明文异或随机数=密文

解密:密文异或随机数=明文

Initialization Vector (IV)

There is a problem in using a fixed key value. Although the key may be updated from time to time, it is fixed relative to the flood of data packets running through the system. Effectively all the data packets are encrypted using the same key value. Suppose you initialize the RC4 algorithm with your key and run the message "qwertyuiop" into it. Suppose you get the encrypted result "b%fP*aF$!Y". This looks good and undecipherable. However, if the key is fixed, every time you run the same text "qwertyuiop" after initialization, you get the same result. In one sense, this is good—if you were to get a different result every time, it might make decryption somewhat tricky. But in another important way, this is very bad because it gives an attacker information. If she spots the same encrypted bytes in a given position, she knows that the original plaintext is being repeated.

  如果使用固定的密钥则使用RC4算法时,对应输入相同的数值时每次都会产生相同的加密结果。这对于攻击者来说,他知道你每次都在重复着相同的明文。

  解决这个问题的办法就是使用初始化向量即IV。把密钥与一个24位数组合在一起代替固定密钥,这样就能改变每个数据包的输出 。它把104位密钥变成了128位。因为IV 值总在变化用于加密的实际密钥也就是随着每个数据包在不断的变化,因此即使输入数据重复了,加密后的密文总是不同。

 但是IV并不是保密的,它也会作为传出信息的一部分,公开传送的。这样接收者才知道解密应该用哪个IV值。理论上,如果不知道密钥的保密部分,知道IV也没有用。对于某一密钥,同一个IV值应该永远不能被使用两次,这样才有效。因为攻击者被重复使用的时候就会被发现,这就是攻击的基础。

  不幸的是,WEP IV 只有24位,大约有1700万个。网络繁忙时IV很容易重复。

Integrity Check Value (ICV)

  完整性校验值的思想是要防止任何人在消息传输过程中进行篡改。在加密和解密消息中,校验码用于检查是否有任何位在传输中被破坏。消息中全部字节合成一个结果,叫CRC。这4个字节的数值被加到即将进行传输的预处理的帧的尾部。即使消息中只有一位被破坏,接收设备也会注意到CRC值不匹配,然后丢弃这个消息。但是攻击者可以在改变消息之后,重新计算CRC的值,使之可以匹配。

  ICVCRC相似,但它是在加密之前计算并添加的。传统的CRC是加密后添加,由于ICV被加密了,攻击者在试图修改消息时不能重新计算它。

WEP 的加密过程

WEP密钥

标准中提到的密钥有两种类型:缺省密钥(default key )和映射密钥

Standard Term

Manufacturer's Term

Default key

Shared key

Group key

Multicast key

Broadcast key

Key

Key mapping key

Individual key

Per-station key

Unique key

标准中并没有规定如何去分配密钥,只是假设密钥已经分配给移动设备了

缺省密钥:

标准中指定每个设备都应该有四个缺省密钥。

其实:

a. 安全工作只需要一个缺省密钥

b. 多个缺省密钥用于帮助你顺利地改变密钥

例如下面的这种情况:

如果AP想要改变密钥,此时就会造成移动客户端失去连接,为了避免这种情况,可以采用使用多个缺省密钥。

多个缺省密钥时是这样工作的:

所有的传输只有一个选定的密钥进行加密,这个密钥叫激活密钥。但对端解密收到的消息时,使用多个密钥中适当的一个。

有了4个密钥,可以在不同的方向上用不同的密钥工作。记住一点,就是发送帧总是用激活密钥加密。假设激活密钥用数字来区分:AP可以用0号密钥来加密数据,移动客户端可以用2号密钥来加密数据。但是AP上的密钥2必须和移动客户端上密钥2相同,移动客户端的密钥0必须和AP上的密钥0相同。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值