Skip to content
Path traversal Advisory Intermediate CVE-2024-39786CVE-2024-39787

Wavlink AC3000 nas.cgi add_dir() Directory Traversal Vulnerabilities

The nas.cgi add_dir() function on the Wavlink AC3000 router fails to filter directory traversal sequences in the adddir_name and disk_part parameters. An authenticated attacker can use these parameters to change permissions of any file or directory on the system to read, write, and execute.

Lilith >_> Follow

Originally disclosed on Cisco Talos

Critical 9.1 View original

Multiple directory traversal vulnerabilities exist in the nas.cgi adddir() functionality of Wavlink AC3000 M33A8.V5030.210505. A specially crafted HTTP request can lead to permission bypass.

Lilith >_>, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The add_dir function passes user-controlled input from the adddir_name and disk_part parameters directly into shell commands without sanitising directory traversal sequences.

Impact

An authenticated attacker could change permissions of any file or directory to read, write, and execute, potentially enabling further compromise such as executing uploaded scripts or accessing the entire file system via FTP.

What the attacker needed

Authenticated access to the router's web interface

The fix

The vendor should sanitise user input to prevent directory traversal sequences and avoid passing unsanitised input to shell commands.

How it was found

  1. Log in to the router's web interface to obtain a valid session cookie.
  2. Send an HTTP POST request to nas.cgi with page=adddir and include a crafted adddir_name or disk_part parameter containing directory traversal sequences.
  3. The router executes mkdir and chmod commands with the unsanitised path, changing permissions of the targeted file or directory to 777.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This router has a web interface where you can create folders. The code that creates folders does not check if you use special characters like '../' to escape the intended folder. So a logged-in user can trick the router into changing permissions of any file on the device, making it readable, writable, and executable by everyone.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by Lilith >_>

View all

148 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.