WiFi Direct Explained

WiFi Direct Explained

What Is WiFi Direct?

WiFi Direct is a specification that allows two WiFi devices to connect directly to each other without an access point or router in between. It was certified by the Wi-Fi Alliance in 2010 and is supported by most modern smartphones, laptops, printers, and TVs.

The underlying mechanism is straightforward: one device acts as a software-based access point (called a Group Owner) and the other connects to it as a regular WiFi client. The connection uses standard WiFi protocols - the same 802.11 frames, the same WPA2 encryption, the same channel access mechanisms. The only difference is that no physical router is involved.

This makes WiFi Direct fundamentally different from ad-hoc (IBSS) mode, which was the previous peer-to-peer WiFi mechanism. Ad-hoc mode had no central coordinator, limited security, and poor performance. WiFi Direct provides full infrastructure-mode performance with proper QoS, power save, and WPA2 security by designating one peer as the coordinator.

The Group Owner System

Every WiFi Direct connection has a Group Owner (GO) and one or more Group Clients (GC). The GO functions as a soft-AP - it beacons, responds to probe requests, handles authentication, and manages the group. The GC connects to the GO exactly as it would connect to a normal access point.

Group Owner selection happens through a negotiation called GO Negotiation. Both devices exchange GO Negotiation Request and Response frames. Each device includes a GO Intent value from 0 to 15 indicating how strongly it wants to be the GO. The device with the higher intent becomes the GO. If both declare the same intent, a tiebreaker bit decides.

In practice, certain devices always prefer to be GO because they have more resources (better antenna, wall power, more processing capability). A printer typically sets its GO Intent high because it needs to be discoverable by multiple clients. A phone might set its intent low and let the other device become GO.

graph TD
    subgraph "WiFi Direct - GO Negotiation"
        DEV_A[Device A] -->|"GO Intent = 7"| NEGOTIATE{GO Negotiation}
        DEV_B[Device B] -->|"GO Intent = 12"| NEGOTIATE
        NEGOTIATE -->|"Higher intent wins"| RESULT["Device B becomes Group Owner"]
        RESULT --> GO_B["Device B - Group Owner
Acts as soft-AP
Beacons, manages group"] RESULT --> GC_A["Device A - Group Client
Connects as regular client"] end subgraph "Active WiFi Direct Group" GO["Group Owner"] -->|"WPA2 encrypted"| GC1[Client 1] GO -->|"WPA2 encrypted"| GC2[Client 2] GO -->|"WPA2 encrypted"| GC3[Client 3] end

The device with higher GO Intent becomes Group Owner and functions as a soft-AP for the connection

Discovery and Connection

Before GO Negotiation, devices need to find each other. WiFi Direct discovery uses a combination of social channel scanning and service discovery:

Device Discovery: Devices alternate between searching (scanning channels 1, 6, and 11 on 2.4GHz - the "social channels") and listening on one of those channels. When a searching device's probe request reaches a listening device, they exchange probe responses containing P2P Information Elements that identify WiFi Direct support and advertised services.

Service Discovery: After finding a device, a client can query what services it offers using Generic Advertisement Service (GAS) frames. This lets a phone discover that a nearby device is a printer, a display, or a file-sharing device before initiating a connection.

The discovery phase can take 1-10 seconds depending on timing alignment between searching and listening devices. The social channel approach ensures devices find each other without scanning all 14 possible 2.4GHz channels.

WPS for Pairing

WiFi Direct uses WiFi Protected Setup (WPS) for the initial security credential exchange. Two methods are available:

Push Button Configuration (PBC): Both devices indicate willingness to connect (usually by the user pressing a button or tapping a prompt on each device). The WPS protocol exchanges credentials automatically. PBC is vulnerable to a race condition - if a third device initiates PBC at the same time, it could potentially join the group instead.

PIN method: One device displays a PIN and the other device's user enters it. This provides better authentication but inherits WPS PIN's known vulnerability to brute-force attacks. The 8-digit PIN is verified in two halves (4+4 digits), reducing the keyspace from 100 million to about 11,000 effective combinations.

These WPS vulnerabilities are well-documented. The PIN brute-force attack, published in 2011, can recover a WPS PIN in hours. While WiFi Direct connections are typically short-lived and initiated intentionally by both users, the WPS layer remains the weakest link in the security chain.

Common Use Cases

Miracast screen mirroring: Miracast uses WiFi Direct to stream display output from a laptop or phone to a TV or projector. The source device and display establish a WiFi Direct connection, then stream H.264-encoded video over it. Miracast can coexist with a regular WiFi connection, so the source device mirrors its screen while staying connected to the internet through its normal WiFi network.

WiFi Direct printing: Most modern wireless printers support WiFi Direct, allowing direct printing from a phone or laptop without both being on the same network. The printer acts as GO and the client connects directly to submit print jobs.

Android file transfer: Android's Nearby Share (now Quick Share) uses WiFi Direct as one of its transport options for large file transfers. After initial discovery over Bluetooth, the devices establish a WiFi Direct connection for the actual data transfer, achieving much higher speeds than Bluetooth alone.

Gaming: Some multiplayer games use WiFi Direct for local multiplayer without internet connectivity. Each player's device joins a WiFi Direct group for low-latency local communication.

Persistent Groups

WiFi Direct supports persistent groups - saved configurations that allow previously paired devices to reconnect quickly without repeating the full discovery and WPS process. When a persistent group is established, both devices store the group credentials. On subsequent connections, the GO recreates the group with the same parameters and the client rejoins using the stored key material.

Persistent groups are convenient but have a security implication: the stored credentials remain valid until explicitly revoked. A device that was once authorized to join a persistent group can rejoin at any time, even if the relationship between the users has changed. Reviewing and clearing persistent WiFi Direct groups is a good practice when selling or lending devices.

graph TD
    subgraph "First Connection - Full Process"
        DISC[Device Discovery - 1-10s] --> GONEG[GO Negotiation]
        GONEG --> WPS[WPS PIN or PBC]
        WPS --> WPA2[WPA2 4-way Handshake]
        WPA2 --> CONN1[Connected - credentials saved]
    end
    subgraph "Persistent Reconnection - Fast"
        REINVOKE[Invitation/Reinvoke] --> SKIP["Skip WPS"]
        SKIP --> RWPA2[WPA2 with stored key]
        RWPA2 --> CONN2["Reconnected in < 1 second"]
    end

Persistent groups store credentials for fast reconnection - skipping the slow discovery and WPS phases

Security Model

WiFi Direct uses WPA2-Personal for data encryption between the GO and clients. The passphrase is generated during the WPS exchange and is typically a random string that the user never sees or enters manually. This means the underlying data encryption is as strong as any WPA2 connection.

The weaknesses are in the setup phase. WPS PBC has the race condition issue. WPS PIN has the brute-force vulnerability. Once the connection is established and WPA2 keys are derived, the data channel is secure. But an attacker who can exploit the WPS setup phase can join the group and intercept traffic.

WiFi Direct groups also lack the enterprise authentication features available in infrastructure WiFi. There is no 802.1X, no RADIUS, no certificate-based authentication. The security model is equivalent to a home WiFi network with WPA2-Personal - adequate for casual use but not suitable for sensitive communications.

WiFi Direct and the BLEShark Nano

WiFi Direct groups appear as regular access points to a WiFi scanner. The BLEShark Nano's scanner will detect WiFi Direct Group Owners as APs broadcasting beacons on the 2.4GHz band. The SSID typically starts with "DIRECT-" followed by a random string and the device name (for example, "DIRECT-xy-HP OfficeJet 9010").

This makes WiFi Direct groups easy to identify during network scanning. The "DIRECT-" prefix is mandated by the specification. By cataloging these SSIDs, you can map the WiFi Direct devices in an area - printers, displays, phones with sharing enabled, gaming consoles - without any active probing.

The P2P Information Elements in WiFi Direct beacons contain additional metadata: the GO's device name, device type (printer, display, phone), supported services, and group capabilities. This information is transmitted in the clear and is readable by any passive scanner, providing a detailed inventory of WiFi Direct-capable devices in range.

Get the BLEShark Nano - $36.99+
Back to blog

Leave a comment