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.
Originally disclosed on Cisco Talos
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.
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
- Authenticate to the CLI over TCP port 6877.
- Send the getenv command with a key containing directory traversal sequences.
- 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.