【问题标题】:ARP when sent IP is wrong in every packet每个数据包中发送的 IP 错误时的 ARP
【发布时间】:2015-02-08 18:09:50
【问题描述】:

我今天在操作系统考试中遇到了一个问题。 给定一个在每个发送的数据包中“伪造”IP 地址的进程(给出错误的 IP 地址),ARP 是否正常工作?

我认为它不会,因为数据包不知道在哪里返回“ack”。

很想听听你的意见。

【问题讨论】:

    标签: ip packet arp


    【解决方案1】:

    我坚持认为它不会,因为数据包不知道在哪里返回“ack”。

    返回给发送者的MAC地址,而不是IP地址。

    来自RFC 826

    当接收到地址解析数据包时,接收以太网 模块将数据包提供给地址解析模块 通过类似于以下的算法。否定条件 表示处理结束并丢弃数据包。

    ?Do I have the hardware type in ar$hrd?
    Yes: (almost definitely)
      [optionally check the hardware length ar$hln]
      ?Do I speak the protocol in ar$pro?
      Yes:
        [optionally check the protocol length ar$pln]
        Merge_flag := false
        If the pair <protocol type, sender protocol address> is
            already in my translation table, update the sender
        hardware address field of the entry with the new
        information in the packet and set Merge_flag to true. 
        ?Am I the target protocol address?
        Yes:
          If Merge_flag is false, add the triplet <protocol type,
              sender protocol address, sender hardware address> to
          the translation table.
          ?Is the opcode ares_op$REQUEST?  (NOW look at the opcode!!)
          Yes:
        Swap hardware and protocol fields, putting the local
            hardware and protocol addresses in the sender fields.
        Set the ar$op field to ares_op$REPLY
        Send the packet to the (new) target hardware address on
            the same hardware on which the request was received.
    

    这是什么意思?

    ARP 使用 MAC 进行返回寻址,尽管 IP 地址也可以包含在数据包的发送方协议地址 (SPA) 字段中。这意味着虽然发件人 IP 地址 (SPA) 被欺骗,但在您的问题中没有提及发件人硬件地址 (SHA) 被欺骗。

    这意味着发送者收到 ARP 回复,并且 ARP 将起作用(从发送机器的角度来看)。但是,由于 ARP 数据包包含欺骗性 SPA,目标机器(以及网络上可能的其他设备)会将发送者关联为具有该 IP 地址,从而成功进行ARP poisoning 攻击:

    例如Linux 会忽略不请自来的回复,但另一方面会使用来自其他机器的已见请求来更新其缓存。

    【讨论】:

      【解决方案2】:

      我认为它会知道将 ack 返回到哪里,因为发送者发送他的 MAC 地址,这很重要。然而我认为它不会起作用,因为接收者会根据他从发送者那里得到的 MAC&IP 来改变他的 ARP 表。 (这是一个微不足道的优化)。

      【讨论】:

        猜你喜欢
        • 2012-11-23
        • 1970-01-01
        • 1970-01-01
        • 2020-03-03
        • 1970-01-01
        • 1970-01-01
        • 2012-12-16
        • 1970-01-01
        • 2021-01-13
        相关资源
        最近更新 更多