OpenCFD OpenFOAM Code Stream directive arbitrary code execution vulnerability
OpenFOAM dictionary files support a #codeStream directive that contains C++ code which is compiled and executed automatically during a simulation. Because the allowSystemOperations option defaults to true, an attacker who supplies a malicious simulation file could run arbitrary code on the machine processing it.
Originally disclosed on Cisco Talos
An arbitrary code execution vulnerability exists in the Code Stream directive functionality of OpenCFD OpenFOAM 2506. A specially crafted OpenFOAM simulation file can lead to arbitrary code execution.
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 dictionary file format allows a #codeStream directive containing C++ that is compiled and executed, and the guard option allowSystemOperations defaults to true without warning the user.
Impact
An attacker could achieve arbitrary code execution on a machine that processes a malicious simulation file, with high impact on confidentiality, integrity and availability, though the victim must open the file.
What the attacker needed
Victim opens a malicious simulation file; allowSystemOperations left at default true
The fix
The configuration option allowSystemOperations should be set to false so that automatic code generation and execution is disabled.
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.
OpenFOAM is software for simulating fluid flow, and it reads plain text settings files to configure each simulation. One of those settings lets the file include C++ program code, which OpenFOAM compiles and runs automatically. Since that feature is switched on by default, opening a simulation file from an untrusted source can run the sender's code on your computer.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.