A critical command injection vulnerability has been discovered in D-Link DIR-823G v1..2 routers, specifically in the SetNetworkTomographySettings function. This high-severity CVE (CVE-2022-43109) allows attackers to execute arbitrary commands by sending a specially crafted packet to the vulnerable device. In this post, we will discuss the details of this vulnerability, including the affected code snippet, links to original references, and information about the exploit.

Code Snippet

The vulnerability lies in the SetNetworkTomographySettings function of the affected router. The following code snippet demonstrates the susceptible part:

// Vulnerable code in SetNetworkTomographySettings function
void SetNetworkTomographySettings(char *input) {
  char cmd[256]; // Buffer for command
  snprintf(cmd, sizeof(cmd), "network_tomography -i %s -o %s", input, output);
  // Command is executed without proper sanitization of 'input'

As we can see, the input is directly passed to the 'system()' function without proper sanitization or validation, allowing an attacker to inject arbitrary commands into the input and execute them on the affected device.

The following sources provide further details about CVE-2022-43109

1. D-Link Security Advisory
2. National Vulnerability Database (NVD) entry
3. "Vulnerability Details: CVE-2022-43109" by Security Researcher

Exploit Details

To exploit this vulnerability, an attacker needs to send a specially crafted packet containing a malicious command to the affected device. The following is a simple proof of concept (PoC):

Craft the malicious input with an arbitrary command, such as 'id'


By executing the above steps, an attacker would be able to run the 'id' command on the affected device, displaying the current user's UID and GID. This is just for demonstration purposes, and an actual attacker could inject more harmful commands.


D-Link has released a firmware update (v1.02B03) for the affected devices to address this vulnerability. Users should immediately update their routers to the latest firmware to protect themselves from this exploit. The latest firmware can be downloaded from the D-Link Support Page. Additionally, users should always practice good security hygiene by monitoring and managing connected systems' security.


CVE-2022-43109 is a critical command injection vulnerability present in D-Link DIR-823G v1..2 routers, specifically in the SetNetworkTomographySettings function. By sending a crafted packet to the affected device, attackers can execute arbitrary commands, making this a high-severity issue. Users are urged to update their routers to the latest firmware to mitigate this threat.


Published on: 11/03/2022 14:15:00 UTC
Last modified on: 11/04/2022 15:52:00 UTC