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

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

The setenv command in the CMA CLI concatenates a user-supplied key to a fixed directory path without validation, allowing directory traversal. An authenticated attacker can overwrite or create arbitrary files, potentially leading to code execution as root.

Matt Wiseman Follow

Originally disclosed on Cisco Talos

Critical 9.1 View original

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

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

Root cause

The setEnv function concatenates the user-supplied key directly to a fixed path without sanitising path traversal sequences.

Impact

An authenticated attacker could overwrite or create arbitrary files, potentially leading to code execution as the root user.

What the attacker needed

Authenticated access to the CLI

The fix

The vendor patched the vulnerability, but the text does not describe the fix.

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 set 'environment variables'. The program takes the name you give and uses it as a filename, but it doesn't check if the name contains '../' sequences that let you escape the intended folder. So you can write files anywhere on the system, which can be abused to run your own code.

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.