Skip to content

Commit aa9f394

Browse files
committed
fix #15
1 parent 9b0f2e0 commit aa9f394

File tree

3 files changed

+19
-32
lines changed

3 files changed

+19
-32
lines changed

DriverBuddyReloaded.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,8 @@ def find_all_ioctls():
213213
# if the penultimate instruction is cmp or sub or mov against an immediate value
214214
if idc.print_insn_mnem(instr) in ['cmp', 'sub', 'mov'] and idc.get_operand_type(instr, 1) == 5:
215215
value = get_operand_value(instr)
216-
digits = utils.check_digits(value)
217-
# value has more than 2 digits (lower false positives) and is not a known NTSTATUS value
218-
if digits > 2 and value not in NTSTATUS.ntstatus_values:
216+
# value >= 0x10000 (lower false positives) and is not a known NTSTATUS value; check issue #15
217+
if value >= 0x10000 and value not in NTSTATUS.ntstatus_values:
219218
ioctls.append((instr, value))
220219
ioctl_tracker.add_ioctl(instr, value)
221220
return ioctls
@@ -259,9 +258,8 @@ def get_position_and_translate():
259258
return
260259

261260
value = get_operand_value(pos)
262-
digits = utils.check_digits(value)
263-
# value has more than 2 digits (lower false positives) and is not a known NTSTATUS value
264-
if digits > 2 and value not in NTSTATUS.ntstatus_values:
261+
# value >= 0x10000 (lower false positives) and is not a known NTSTATUS value; check issue #15
262+
if value >= 0x10000 and value not in NTSTATUS.ntstatus_values:
265263
ioctl_tracker.add_ioctl(pos, value)
266264
define = ioctl_decoder.get_define(value)
267265
make_comment(pos, define)

DriverBuddyReloaded/utils.py

-14
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,3 @@ def is_driver():
248248
return func_addr
249249
return False
250250

251-
252-
def check_digits(n):
253-
"""
254-
Given an integer number return how many digits it has
255-
:param n: number to check digits
256-
:return:
257-
"""
258-
if n > 0:
259-
digits = int(math.log10(n)) + 1
260-
elif n == 0:
261-
digits = 1
262-
else:
263-
digits = int(math.log10(-n)) + 2 # +1 if you don't count the '-'
264-
return digits

README.MD

+15-12
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
## Table of Contents
44

5-
1. [Installation](#Installation)
6-
2. [Quick Usage](#Quick-Usage)
7-
1. [Advanced Usage](#Advanced-Usage)
8-
3. [About Driver Buddy Reloaded](#About-Driver-Buddy-Reloaded)
9-
1. [Finding DispatchDeviceControl](#Finding-DispatchDeviceControl)
10-
2. [Labelling WDM & WDF Structures](#Labelling-WDM-and-WDF-Structures)
11-
3. [Finding & Decoding IOCTL Codes](#Finding-and-Decoding-IOCTL-Codes)
12-
4. [Flagging Functions](#Flagging-Functions)
13-
5. [Finding DeviceName](#Finding-DeviceName)
14-
6. [Dumping Pooltags](#Dumping-Pooltags)
15-
4. [Known Caveats & Limitations](#Known-Caveats-and-Limitations)
16-
5. [Credits & Acknowledgements](#Credits-and-Acknowledgements)
5+
- [Driver Buddy Reloaded Quickstart](#driver-buddy-reloaded-quickstart)
6+
- [Table of Contents](#table-of-contents)
7+
- [Installation](#installation)
8+
- [Quick Usage](#quick-usage)
9+
- [Advanced Usage](#advanced-usage)
10+
- [About Driver Buddy Reloaded](#about-driver-buddy-reloaded)
11+
- [Finding DispatchDeviceControl](#finding-dispatchdevicecontrol)
12+
- [Labelling WDM and WDF Structures](#labelling-wdm-and-wdf-structures)
13+
- [Finding and Decoding IOCTL Codes](#finding-and-decoding-ioctl-codes)
14+
- [Flagging Functions](#flagging-functions)
15+
- [Finding DeviceName](#finding-devicename)
16+
- [Dumping Pooltags](#dumping-pooltags)
17+
- [Known Caveats and Limitations](#known-caveats-and-limitations)
18+
- [Credits and Acknowledgements](#credits-and-acknowledgements)
1719

1820
## Installation
1921

@@ -158,6 +160,7 @@ with `pooltags.txt`. The output can then be copy-pasted at the end of the file a
158160

159161
## Known Caveats and Limitations
160162

163+
- Only IOCTL values >= 0x10000 will be automatically decoded, thus to prevent an high number of false positives. [Issue #15](https://github.com/VoidSec/DriverBuddyReloaded/issues/15)
161164
- Experimental `DispatchDeviceControl` searching works only for x64 drivers
162165
- Shortcuts are incompatible with F-Secure's [win_driver_plugin](https://github.com/FSecureLABS/win_driver_plugin)
163166
- Shortcuts are incompatible with [findcrypt-yara](https://github.com/polymorf/findcrypt-yara)

0 commit comments

Comments
 (0)