Skip to content
Path traversal Advisory Intermediate CVE-2021-21907

Garrett Metal Detectors iC Module CMA CLI getenv command directory traversal vulnerability

The getenv command in the CMA CLI concatenates a user-supplied key to a fixed path without sanitisation, allowing directory traversal to read files. An authenticated attacker could read small files (up to 396 bytes) but larger files cause a crash due to a buffer overflow.

Matt Wiseman Follow

Originally disclosed on Cisco Talos

Medium 4.9 View original

A directory traversal vulnerability exists in the CMA CLI getenv command functionality of Garrett Metal Detectors’ iC Module CMA Version 5.0. A specially-crafted command line argument can lead to local file inclusion.

Matt Wiseman, 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

Impact

An authenticated attacker could read small files (up to 396 bytes) from the device, but larger files cause a crash, and code execution was not achieved.

What the attacker needed

Authenticated access to the CLI

The fix

The vulnerability was fixed by the vendor.

How it was found

  1. Authenticate to the CLI over TCP port 6877.
  2. Send the getenv command with a key containing directory traversal sequences.
  3. The device reads the file and returns its contents if it is small enough.

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.

The device has a command-line interface where you can ask for 'environment variables'. The program builds a file path by sticking your input onto a fixed folder name, without checking for '../' sequences. By using '../', you can escape the intended folder and read other files on the system, but only small ones because bigger files crash the program.

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 Matt Wiseman

View all

73 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.