subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
src = Path(tempfile.gettempdir()) / "lo_socket_shim.c" src.write_text(_SHIM_SOURCE) subprocess.run( ["gcc", "-shared", "-fPIC", "-o", str(_SHIM_SO), str(src), "-ldl"], check=True, capture_output=True,- Confidence
- 96% confidence
- Finding
- The code writes C source to a predictable temporary path and then executes gcc to produce a shared object that will later be injected via LD_PRELOAD. In a multi-user or adversarial local environment, predictable temp-file and output-file reuse can enable race/symlink attacks or malicious preplacement of the .so, leading to arbitrary code execution in the LibreOffice process.
