Use of insecure temporary file in Horovod
Horovod used the insecure tempfile.mktemp() function to create a rank file when run with jsrun in an LSF job. Another process could hijack this file to read or manipulate its content.
horovod/horovod
Originally disclosed on huntr
Impact
The insecure tempfile.mktemp() is used when Horovod is run in an LSF job with jsrun. In that situation, a jsrun rank file is created with mktemp, which could be hijacked by another process to read or manipulate the content.
This issue does not impact the use of MPI, Gloo, Spark or Ray.
Patches
The problem has been fixed in b96ecae4.
Workarounds
The rank file is not created when binding_args are provided in the Settings instance.
References
Please see https://github.com/horovod/horovod/pull/3358 for details.
For more information
If you have any questions or comments about this advisory:
- Open an issue in https://github.com/horovod/horovod
From the GitHub Advisory Database (GHSA-47wv-vhj2-g66m, CC BY 4.0).
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 use of tempfile.mktemp(), which returns a filename without creating the file, allowing a race condition where another process can create the file first.
Impact
An attacker could hijack the temporary rank file to read or manipulate its content, but only when Horovod is run with jsrun in an LSF job; other backends are not affected.
What the attacker needed
Horovod run with jsrun in an LSF job; another process on the same system
The fix
The problem was fixed in commit b96ecae4.
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.
When a program needs a temporary file, it should create it in a way that no other program can guess or interfere with. Here, the program used a function that only generates a name but does not create the file, leaving a window for another process to create that file first and control its contents. This could let an attacker read or change data the program writes to the file.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.