---
title: "CWE-781: Improper Address Validation in IOCTL with METHOD_NEITHER I/O Control Code"
url: https://radicalnotion.ai/cwe/cwe-781
type: cwe
description: "The product defines an IOCTL that uses METHOD_NEITHER for I/O, but it does not validate or incorrectly validates the addresses that are provided."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-781: Improper Address Validation in IOCTL with METHOD\_NEITHER I/O Control Code

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The product defines an IOCTL that uses METHOD\_NEITHER for I/O, but it does not validate or incorrectly validates the addresses that are provided.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** C (Often), C++ (Often)

**Operating systems:** Windows NT (Sometimes)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Availability, Confidentiality | Modify Memory, Read Memory, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart | If validation is missing or incorrect, an attacker can supply arbitrary memory addresses for memory that belongs to another process or user. If the attacker can control the contents that the IOCTL writes, it may lead to code execution at high privilege levels. At the least, a crash can occur. |

## Potential mitigations

### Implementation

If METHOD\_NEITHER is required for the IOCTL, then ensure that all user-space addresses are properly validated before they are first accessed. The ProbeForRead and ProbeForWrite routines are available for this task. Also properly protect and manage the user-supplied buffers, since the I/O Manager does not do this when METHOD\_NEITHER is being used. See References.

### Architecture and Design

If possible, avoid using METHOD\_NEITHER in the IOCTL and select methods that effectively control the buffer size, such as METHOD\_BUFFERED, METHOD\_IN\_DIRECT, or METHOD\_OUT\_DIRECT.

### Architecture and Design, Implementation

If the IOCTL is part of a driver that is only intended to be accessed by trusted users, then use proper access control for the associated device or device namespace. See References.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2006-2373 | Driver for file-sharing and messaging protocol allows attackers to execute arbitrary code. |
| CVE-2009-0686 | Anti-virus product does not validate addresses, allowing attackers to gain SYSTEM privileges. |
| CVE-2009-0824 | DVD software allows attackers to cause a crash. |
| CVE-2008-5724 | Personal firewall allows attackers to gain SYSTEM privileges. |
| CVE-2007-5756 | Chain: device driver for packet-capturing software allows access to an unintended IOCTL with resultant array index error. |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-1285](https://radicalnotion.ai/cwe/cwe-1285) | Improper Validation of Specified Index, Position, or Offset in Input |
| Can precede | [CWE-822](https://radicalnotion.ai/cwe/cwe-822) | Untrusted Pointer Dereference |
| Related | [CWE-782](https://radicalnotion.ai/cwe/cwe-782) | Exposed IOCTL with Insufficient Access Control |

## Frequently asked questions

### What is CWE-781?

The product defines an IOCTL that uses METHOD\_NEITHER for I/O, but it does not validate or incorrectly validates the addresses that are provided.

### How do you prevent CWE-781?

If METHOD\_NEITHER is required for the IOCTL, then ensure that all user-space addresses are properly validated before they are first accessed. The ProbeForRead and ProbeForWrite routines are available for this task. Also properly protect and manage the user-supplied buffers, since the I/O Manager does not do this when METHOD\_NEITHER is being used. See References.

### What are the consequences of CWE-781?

Exploiting CWE-781 can lead to: Modify Memory, Read Memory, Execute Unauthorized Code or Commands, DoS: Crash, Exit, or Restart.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/781.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-781). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
