Summary
Using --addr-pool
with an IPv4 address that lacks a subnet mask causes the system to allow all IP addresses. This can unintentionally expose the service to all incoming connections and bypass intended access restrictions.
Details
The issue was observed on Ubuntu 22.04 LTS.
address = strtok(cp, "/");
mask = strtok(NULL, "/");
ret = addr_pool_insert(apool, address, (uint8)(mask ? atoi(mask) : 0));
source code
When subnet mask is not specified, the addr-pool
entry is added with a mask value of 0.
This behavior has only been confirmed on Linux, but similar behavior may be present on other platforms.
PoC
Build wasm-micro-runtime/samples/socket-api to use tcp_server.wasm
, tcp_client.wasm
.
Use iwasm-2.4.0-x86_64-ubuntu-22.04.tar.gz to run wasm files.
Start tcp server.
./iwasm --addr-pool=0.0.0.0/15 tcp_server.wasm
Start tcp client and set any IPv4 address without subnet mask.
./iwasm --addr-pool=1.2.3.4 tcp_client.wasm
[Client] Create socket
[Client] Connect socket
[Client] Local address is: 127.0.0.1:34536
[Client] Client receive
[Client] 115 bytes received:
Buffer received:
Say Hi from the Server
Say Hi from the Server
Say Hi from the Server
Say Hi from the Server
Say Hi from the Server
[Client] BYE
Despite an incorrect IP address, the program operates properly.
Impact
Services relying on --addr-pool
for restricting access by IP may unintentionally become open to all external connections. This may lead to unauthorized access in production deployments, especially when users assume that specifying an IP without a subnet mask implies a default secure configuration.
Summary
Using
--addr-pool
with an IPv4 address that lacks a subnet mask causes the system to allow all IP addresses. This can unintentionally expose the service to all incoming connections and bypass intended access restrictions.Details
The issue was observed on Ubuntu 22.04 LTS.
source code
When subnet mask is not specified, the
addr-pool
entry is added with a mask value of 0.This behavior has only been confirmed on Linux, but similar behavior may be present on other platforms.
PoC
Build wasm-micro-runtime/samples/socket-api to use
tcp_server.wasm
,tcp_client.wasm
.Use iwasm-2.4.0-x86_64-ubuntu-22.04.tar.gz to run wasm files.
Start tcp server.
Start tcp client and set any IPv4 address without subnet mask.
Despite an incorrect IP address, the program operates properly.
Impact
Services relying on
--addr-pool
for restricting access by IP may unintentionally become open to all external connections. This may lead to unauthorized access in production deployments, especially when users assume that specifying an IP without a subnet mask implies a default secure configuration.