GHSL-2020-113: Command injection vulnerability in limdu - CVE-2020-4066
The trainBatch function in the Limdu library passes user-supplied learn_args to a shell command, allowing command injection. An attacker who controls the learn_args input could execute arbitrary commands on the host.
Originally disclosed on GitHub Security Lab
The trainBatch function has a command injection vulnerability. Clients of the Limdu library are unlikely to be aware of this, so they might unwittingly write code that contains a vulnerability.
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
Likely the library uses child_process.exec with a string that includes user-controlled learn_args, so shell metacharacters are interpreted as commands.
Impact
This issue may lead to remote code execution if a client of the library calls the vulnerable method with untrusted input.
What the attacker needed
Client passes untrusted input to learn_args
How it was found
- Install the Limdu library.
- Create a fake binary named liblinear_train and put it on the PATH.
- Write a JavaScript file that creates a classifier with a learn_args value containing a shell command.
- Run the JavaScript file with node.
- Observe that the injected command created a file named exploit.
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 report is about a library that lets you train machine learning models. The library runs an external program to do the training, and it builds the command line by gluing together text you provide. If that text contains special characters, the computer may run extra commands you did not intend, which is called command injection.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.