2

我想使用模糊测试技术测试我的存储驱动程序,并且我选择了称为 IoAttack 的 Microsoft 工具,它在 WDK 8.1 中表示为测试用例,而不是像以前版本的 WDK 中那样的独立应用程序。此工具与 IoSpy 工具一起使用,该工具收集发送到驱动程序的所有 IOCTL 和 WMI 命令。IoSpy 附加到驱动程序堆栈作为过滤驱动程序并记录所有流量。在我成功附加 IoSpy、记录所有数据而不是删除 IoSpy 并运行 IoAttack 后出现问题。因为 IoAttack 看不到我的存储驱动程序创建的设备,所以我无法对我的驱动程序进行模糊测试。以下是我使用的步骤和配置。

任何提示或解决方案都将受到欢迎:)

【测试机设置步骤:】

  1. 安装创建存储设备的驱动程序

  2. 安装包“WDK 测试目标设置”

    • 默认位置:C:\Program Files (x86)\Windows Kits\8.1\Remote\x64
    • 安装了 WDK 8.1 组件的计算机上的默认位置
    • 安装命令:msiexec /i "WDK Test Target Setup x64-x64_en-us.msi"

2.1 如果您的目标计算机运行的是Windows Server,请找到刚刚由WDK Test Target Setup MSI 创建的DriverTest 文件夹。(例如:c:\DriverTest)。右键单击 DriverTest 文件夹,然后选择属性。在“安全”选项卡上,将“修改”权限授予 Authenticated Users 组。

  1. 安装包测试创作和执行框架(TAEF)”

    • 默认位置:C:\Program Files (x86)\Windows Kits\8.1\Testing\Runtimes
    • 安装了 WDK 8.1 组件的计算机上的默认位置
    • 安装命令:msiexec /i "Test Authoring and Execution Framework x64-x64_en-us.msi"
  2. 安装包“WDTF 运行时库”

    • 默认位置:C:\Program Files (x86)\Windows Kits\8.1\Testing\Runtimes
    • 安装了 WDK 8.1 组件的计算机上的默认位置
    • 安装命令:msiexec /i "Windows Driver Testing Framework (WDTF) Runtime Libraries-x64_en-us.msi"
    • 安装验证:
      • 在测试计算机上打开命令提示符窗口。
      • 运行 %WDTFDir%\Tools\CheckWDTFInstall.cmd
        • 默认位置:C:\Program Files (x86)\Windows Kits\8.1\Testing\Runtimes\WDTF
      • 打开日志文件 CheckWDTFInstall.log 并检查包含所有已安装 WDTF 组件信息的结果
  3. 设置模式“内核调试”

    • 脚步:
      • 以管理员身份打开命令提示符窗口。输入 bcdedit /debug on
      • 如果计算机尚未配置为调试传输的目标,请输入 bcdedit /dbgsettings local
      • 重新启动计算机。

[使用 IoSpy 和 IoAttack 的测试程序:]

  1. 使用 WDK 测试“EnableIoSpy”和应用程序“TAEF”启用 IoSpy
    • 命令:

Te.exe "%SystemDrive%\Tests\Additional Tests\DeviceFundamentals\ERT\Basic\Devfund_IOSpy_EnableSupport_ERT_Basic.wsc" /select:"@Name='Devfund::EnableIoSpy'" /p:"DQ=INF::OriginalInfFileName='my_storage_driver .inf'" /p:"DFD=%systemdrive%\DriverTest\IoSpy" /rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs \Enable_I_O_Spy_(Quick)_(possible_reboot)_00000.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated

  1. 重启操作系统

  2. 对公共和私有 IOCTL 使用 IOCTL 命令

  3. 验证记录通过 IOCTL 和 WMI 请求发送到为启用模糊测试的设备的驱动程序发送的数据的 IoSpy 数据文件是否大于初始 1 KB 大小(如果不是特定驱动程序的数据获取失败)

    • IoSpy 数据文件的默认位置:%SystemDrive%\DriverTest\IoSpy
  4. 使用 WDK 测试“DisableIoSpy”和应用程序“TAEF”禁用 IoSpy

    • 命令:

te.exe "%SystemDrive%\Tests\Additional Tests\DeviceFundamentals\ERT\Basic\Devfund_IOSpy_DisableSupport_ERT_Basic.wsc" /select:"@Name='Devfund::DisableIoSpy'" /rebootStateFile:%systemdrive%\DriverTest\Logs\DriverTestReboot. xml /enableWttLogging /wttDeviceString:$LogFile:file="%systemdrive%\DriverTest\Logs\Disable_I_O_Spy_(Quick)_(possible_reboot)_00000.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest| WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated

  1. 重启操作系统

  2. 使用 WDK 测试“RunIoAttack”和应用程序“TAEF”运行 I/O 攻击(快速)模糊器

    • 命令:

te.exe "%SystemDrive%\DATA\Tests\Additional Tests\DeviceFundamentals\ERT\Basic\Devfund_IOAttack_ERT_Basic.wsc" /select:"@Name='Devfund::RunIoAttack'" /p:"DQ=DeviceID='my_device_id_that_was_created_by_my_storage_driver" /rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Run_I_O_Attack_(Quick)_00001.wtl",writemode=append,encoding=unicode, nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated

[问题:] 从 WDK 作为测试运行的 Microsoft fuzzer IoAttack 看不到 my_storage_driver。测试通过,因为我们没有找到用于测试的设备。测试输出:

*

StartGroup:Devfund::RunIoAttack 属性:TAEF:描述 [运行 I/O 攻击。] WDTF_TARGETS: - Query("IsDevice AND IoSpy::") WDTF_TEST: 未找到用于测试的设备 EndGroup: Devfund::RunIoAttack [通过] 摘要:Total=1, Passed=1, Failed=0, Blocked=0, Not运行=0,跳过=0

*

用于使用 WDK 应用程序“TAEF”(te.exe)运行测试的命令

te.exe "%SystemDrive%\Tests\Additional Tests\DeviceFundamentals\ERT\Basic\Devfund_IOAttack_ERT_Basic.wsc" /select:"@Name='Devfund::RunIoAttack'" /p:"DQ=DeviceID='my_device_id_that_was_created_by_my_storage_driver'" / rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml /enableWttLogging /wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Run_I_O_Attack_(Quick)_00001.wtl",writemode=append,encoding=unicode,nofscache =true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*" /runas:Elevated

[附加信息:] 我尝试使用 DQ=DeviceID, DQ=INF::OriginalInfFileName 来解决我的驱动程序/存储设备以进行模糊测试(就像在 IoSpy 情况下一样),但最终不起作用。

IoSpy 和 IoAttack 的使用过程源来自https://msdn.microsoft.com/en-us/library/windows/hardware/ff547271

[测试机器设置:] - Windows Server 2012 R2 Standard Build 9600 (x64)

[软件设置:] - WDK 8.1 安装在 Windows 7 Professional (x64) 上

4

0 回答 0